From d462dce7a04b33a1e7e03219a69344ef952e9627 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 6 May 2014 22:31:38 -0700 Subject: [PATCH 1/3] Set to Jekyll@2.0.0 --- jekyll-html-pipeline.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jekyll-html-pipeline.gemspec b/jekyll-html-pipeline.gemspec index 46a95d2..a1872d1 100644 --- a/jekyll-html-pipeline.gemspec +++ b/jekyll-html-pipeline.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test)/}) spec.require_paths = ["lib"] - spec.add_dependency "jekyll", "~> 2.0.0.alpha.1 " + spec.add_dependency "jekyll", "~> 2.0.0" spec.add_dependency('html-pipeline', "~> 1.0.0") spec.add_development_dependency "bundler", "~> 1.4" From d8eb73c3b471a73240b96293ce8ef6148ddd3f00 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 6 May 2014 23:15:30 -0700 Subject: [PATCH 2/3] Switch to using Minitest --- jekyll-html-pipeline.gemspec | 12 ++--- test/helper.rb | 48 ------------------- test/test_helper.rb | 51 ++++++++++++++++++++ test/test_jekyll_html_pipeline.rb | 80 +++++++++++++++---------------- 4 files changed, 96 insertions(+), 95 deletions(-) delete mode 100644 test/helper.rb create mode 100644 test/test_helper.rb diff --git a/jekyll-html-pipeline.gemspec b/jekyll-html-pipeline.gemspec index a1872d1..697ace9 100644 --- a/jekyll-html-pipeline.gemspec +++ b/jekyll-html-pipeline.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |spec| spec.name = "jekyll-html-pipeline" - spec.version = "0.1.0" + spec.version = "0.1.1" spec.authors = ["Garen Torikian"] spec.email = ["gjtorikian@gmail.com"] spec.summary = %q{Use GitHub's HTML::Pipeline, in Jekyll!} @@ -14,13 +14,13 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] spec.add_dependency "jekyll", "~> 2.0.0" - spec.add_dependency('html-pipeline', "~> 1.0.0") + spec.add_dependency 'html-pipeline', "~> 1.0.0" spec.add_development_dependency "bundler", "~> 1.4" spec.add_development_dependency "rake" - spec.add_development_dependency('shoulda', "~> 3.5") - spec.add_development_dependency('github-markdown', "~> 0.6.3") - spec.add_development_dependency('sanitize', "~> 2.0.6") - spec.add_development_dependency('gemoji', "~> 1.5.0") + spec.add_development_dependency 'minitest', "~> 5.0" + spec.add_development_dependency 'github-markdown', "~> 0.6.3" + spec.add_development_dependency 'sanitize', "~> 2.0.6" + spec.add_development_dependency 'gemoji', "~> 1.5.0" spec.add_development_dependency "rouge" end diff --git a/test/helper.rb b/test/helper.rb deleted file mode 100644 index 72920ee..0000000 --- a/test/helper.rb +++ /dev/null @@ -1,48 +0,0 @@ -require "rubygems" - -require "jekyll" -require "liquid" - -require 'test/unit' -require 'shoulda' - -require "html/pipeline" - -require "jekyll-html-pipeline" - -# Send STDERR into the void to suppress program output messages -# STDERR.reopen(test(?e, '/dev/null') ? '/dev/null' : 'NUL:') - -class Test::Unit::TestCase - def dest_dir(*subdirs) - test_dir('dest', *subdirs) - end - - def source_dir(*subdirs) - test_dir('source', *subdirs) - end - - def clear_dest - FileUtils.rm_rf(dest_dir) - end - - def test_dir(*subdirs) - File.join(File.dirname(__FILE__), *subdirs) - end - - def directory_with_contents(path) - FileUtils.rm_rf(path) - FileUtils.mkdir(path) - File.open("#{path}/index.html", "w"){ |f| f.write("I was previously generated.") } - end - - def capture_stdout - $old_stdout = $stdout - $stdout = StringIO.new - yield - $stdout.rewind - return $stdout.string - ensure - $stdout = $old_stdout - end -end diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 0000000..0110616 --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,51 @@ +require "rubygems" + +require "jekyll" +require "liquid" + +require 'minitest/autorun' + +require "jekyll-html-pipeline" + +# Send STDERR into the void to suppress program output messages +# STDERR.reopen(test(?e, '/dev/null') ? '/dev/null' : 'NUL:') + +module Converter + class HTMLPipelineTestCase < MiniTest::Test + end +end + +# module +# class Test::Unit::TestCase +# def dest_dir(*subdirs) +# test_dir('dest', *subdirs) +# end + +# def source_dir(*subdirs) +# test_dir('source', *subdirs) +# end + +# def clear_dest +# FileUtils.rm_rf(dest_dir) +# end + +# def test_dir(*subdirs) +# File.join(File.dirname(__FILE__), *subdirs) +# end + +# def directory_with_contents(path) +# FileUtils.rm_rf(path) +# FileUtils.mkdir(path) +# File.open("#{path}/index.html", "w"){ |f| f.write("I was previously generated.") } +# end + +# def capture_stdout +# $old_stdout = $stdout +# $stdout = StringIO.new +# yield +# $stdout.rewind +# return $stdout.string +# ensure +# $stdout = $old_stdout +# end +# end diff --git a/test/test_jekyll_html_pipeline.rb b/test/test_jekyll_html_pipeline.rb index 9ae8f28..3d6b5bb 100644 --- a/test/test_jekyll_html_pipeline.rb +++ b/test/test_jekyll_html_pipeline.rb @@ -1,50 +1,48 @@ -require "helper" +require "test_helper" -class HTMLPipeline < Test::Unit::TestCase - context "html_pipeline" do - setup do - @config = { - 'html_pipeline' => { - 'filters' => ['markdownfilter', 'sanitizationfilter', 'emojifilter', 'mentionfilter'], - 'context' => { 'asset_root' => "http://foo.com/icons", 'base_url' => "https://github.com/"}}, - 'markdown' => 'HTMLPipeline' - } - @markdown = Jekyll::Converters::Markdown.new @config - end +class HTMLPipelineTest < Converter::HTMLPipelineTestCase + def setup + @config = { + 'html_pipeline' => { + 'filters' => ['markdownfilter', 'sanitizationfilter', 'emojifilter', 'mentionfilter'], + 'context' => { 'asset_root' => "http://foo.com/icons", 'base_url' => "https://github.com/"}}, + 'markdown' => 'HTMLPipeline' + } + @markdown = Jekyll::Converters::Markdown.new @config + end - should "pass regular options" do - assert_equal "

Some Header

", @markdown.convert('# Some Header #').strip - end + def test_passes_regular_options + assert_equal "

Some Header

", @markdown.convert('# Some Header #').strip + end - should "pass rendering emoji" do - assert_equal "

\":trollface:\"

", @markdown.convert(':trollface:').strip - end + def test_pass_rendering_emoji + assert_equal "

\":trollface:\"

", @markdown.convert(':trollface:').strip + end - should "pass rendering mentions" do - assert_equal "

Hey, @mojombo!

", @markdown.convert('**Hey, @mojombo**!').strip - end + def test_pass_rendering_mentions + assert_equal "

Hey, @mojombo!

", @markdown.convert('**Hey, @mojombo**!').strip + end - should "fail when a library dependency is not met" do - override = @config.dup - override['html_pipeline']['filters'] << 'AutolinkFilter' - markdown = Jekyll::Converters::Markdown.new override - assert_raise(LoadError) { markdown.convert('http://www.github.com') } - end + def test_fail_when_a_library_dependency_is_not_met + override = @config.dup + override['html_pipeline']['filters'] << 'AutolinkFilter' + markdown = Jekyll::Converters::Markdown.new override + assert_raises(LoadError) { markdown.convert('http://www.github.com') } + end - should "fail when a context dependency is not met" do - override = @config.dup - override['html_pipeline'].delete 'context' - markdown = Jekyll::Converters::Markdown.new override - assert_raise(ArgumentError) { markdown.convert(':trollface:') } - end + def test_fail_when_a_context_dependency_is_not_met + override = @config.dup + override['html_pipeline'].delete 'context' + markdown = Jekyll::Converters::Markdown.new override + assert_raises(ArgumentError) { markdown.convert(':trollface:') } + end - should "work for custom filters" do - require 'support/new_pipeline' - override = @config.dup - override['html_pipeline']['filters'] = ['HelpMarkdownFilter'] - markdown = Jekyll::Converters::Markdown.new override - text = "\n {{#tip}}\n **Tip**: Wow! \n {{/tip}}" - assert_equal "

\n Tip: Wow!
\n
", markdown.convert(text) - end + def test_work_for_custom_filters + require 'support/new_pipeline' + override = @config.dup + override['html_pipeline']['filters'] = ['HelpMarkdownFilter'] + markdown = Jekyll::Converters::Markdown.new override + text = "\n {{#tip}}\n **Tip**: Wow! \n {{/tip}}" + assert_equal "

\n Tip: Wow!
\n
", markdown.convert(text) end end From 8a50031dcb746ed40223e7fae79e0e944aa1ed68 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 6 May 2014 23:19:20 -0700 Subject: [PATCH 3/3] Remove rouge dependency --- jekyll-html-pipeline.gemspec | 1 - 1 file changed, 1 deletion(-) diff --git a/jekyll-html-pipeline.gemspec b/jekyll-html-pipeline.gemspec index 697ace9..4e7d95f 100644 --- a/jekyll-html-pipeline.gemspec +++ b/jekyll-html-pipeline.gemspec @@ -22,5 +22,4 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'github-markdown', "~> 0.6.3" spec.add_development_dependency 'sanitize', "~> 2.0.6" spec.add_development_dependency 'gemoji', "~> 1.5.0" - spec.add_development_dependency "rouge" end