Skip to content

Commit

Permalink
Merge pull request #4 from gjtorikian/bump-jekyll-requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
gjtorikian committed May 7, 2014
2 parents 22db94f + 8a50031 commit fd425a5
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 97 deletions.
15 changes: 7 additions & 8 deletions jekyll-html-pipeline.gemspec
Original file line number Diff line number Diff line change
@@ -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 = ["[email protected]"]
spec.summary = %q{Use GitHub's HTML::Pipeline, in Jekyll!}
Expand All @@ -13,14 +13,13 @@ 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('html-pipeline', "~> 1.0.0")
spec.add_dependency "jekyll", "~> 2.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 "rouge"
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"
end
48 changes: 0 additions & 48 deletions test/helper.rb

This file was deleted.

51 changes: 51 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -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
80 changes: 39 additions & 41 deletions test/test_jekyll_html_pipeline.rb
Original file line number Diff line number Diff line change
@@ -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 "<h1>Some Header</h1>", @markdown.convert('# Some Header #').strip
end
def test_passes_regular_options
assert_equal "<h1>Some Header</h1>", @markdown.convert('# Some Header #').strip
end

should "pass rendering emoji" do
assert_equal "<p><img class=\"emoji\" title=\":trollface:\" alt=\":trollface:\" src=\"http://foo.com/icons/emoji/trollface.png\" height=\"20\" width=\"20\" align=\"absmiddle\"></p>", @markdown.convert(':trollface:').strip
end
def test_pass_rendering_emoji
assert_equal "<p><img class=\"emoji\" title=\":trollface:\" alt=\":trollface:\" src=\"http://foo.com/icons/emoji/trollface.png\" height=\"20\" width=\"20\" align=\"absmiddle\"></p>", @markdown.convert(':trollface:').strip
end

should "pass rendering mentions" do
assert_equal "<p><strong>Hey, <a href=\"https://github.com/mojombo\" class=\"user-mention\">@mojombo</a></strong>!</p>", @markdown.convert('**Hey, @mojombo**!').strip
end
def test_pass_rendering_mentions
assert_equal "<p><strong>Hey, <a href=\"https://github.com/mojombo\" class=\"user-mention\">@mojombo</a></strong>!</p>", @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://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://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 "<div class=\"alert tip\"><br>\n <strong>Tip</strong>: Wow! <br>\n </div>", 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 "<div class=\"alert tip\"><br>\n <strong>Tip</strong>: Wow! <br>\n </div>", markdown.convert(text)
end
end

0 comments on commit fd425a5

Please sign in to comment.