diff --git a/.rubocop.yml b/.rubocop.yml index 2ceac7c4..ac3c8300 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -70,34 +70,13 @@ AllCops: - features/step_definitions.rb - features/support/formatter.rb - features/support/helpers.rb - - test/helper.rb - - test/simplecov_custom_profile.rb - - test/test_ansi.rb - - test/test_cleaner.rb - - test/test_coffeescript.rb - - test/test_collections.rb - - test/test_command.rb - - test/test_commands_serve.rb - test/test_configuration.rb - - test/test_convertible.rb - - test/test_doctor_command.rb - test/test_document.rb - test/test_entry_filter.rb - - test/test_excerpt.rb - test/test_filters.rb - - test/test_front_matter_defaults.rb - - test/test_generated_site.rb - test/test_kramdown.rb - - test/test_layout_reader.rb - - test/test_liquid_extensions.rb - test/test_liquid_renderer.rb - - test/test_log_adapter.rb - - test/test_new_command.rb - test/test_page.rb - - test/test_path_sanitization.rb - - test/test_plugin_manager.rb - - test/test_rdiscount.rb - - test/test_redcarpet.rb - test/test_regenerator.rb - test/test_related_posts.rb - test/test_sass.rb diff --git a/test/helper.rb b/test/helper.rb index ade8b77d..3a3dafa2 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -6,7 +6,7 @@ $stdout.puts "# -------------------------------------------------------------" $VERBOSE = nil def jruby? - defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby' + defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby" end if ENV["CI"] @@ -22,23 +22,23 @@ else end require "nokogiri" -require 'rubygems' -require 'ostruct' -require 'minitest/autorun' -require 'minitest/reporters' -require 'minitest/profile' -require 'rspec/mocks' -require 'jekyll' +require "rubygems" +require "ostruct" +require "minitest/autorun" +require "minitest/reporters" +require "minitest/profile" +require "rspec/mocks" +require "jekyll" Jekyll.logger = Logger.new(StringIO.new) unless jruby? - require 'rdiscount' - require 'redcarpet' + require "rdiscount" + require "redcarpet" end -require 'kramdown' -require 'shoulda' +require "kramdown" +require "shoulda" include Jekyll @@ -51,16 +51,12 @@ Minitest::Reporters.use! [ module Minitest::Assertions def assert_exist(filename, msg = nil) - msg = message(msg) { - "Expected '#{filename}' to exist" - } + msg = message(msg) { "Expected '#{filename}' to exist" } assert File.exist?(filename), msg end def refute_exist(filename, msg = nil) - msg = message(msg) { - "Expected '#{filename}' not to exist" - } + msg = message(msg) { "Expected '#{filename}' not to exist" } refute File.exist?(filename), msg end end @@ -69,8 +65,8 @@ class JekyllUnitTest < Minitest::Test include ::RSpec::Mocks::ExampleMethods def mocks_expect(*args) - RSpec::Mocks::ExampleMethods::ExpectHost.instance_method(:expect).\ - bind(self).call(*args) + RSpec::Mocks::ExampleMethods::ExpectHost.instance_method(:expect)\ + .bind(self).call(*args) end def before_setup @@ -105,16 +101,16 @@ class JekyllUnitTest < Minitest::Test end def dest_dir(*subdirs) - test_dir('dest', *subdirs) + test_dir("dest", *subdirs) end def source_dir(*subdirs) - test_dir('source', *subdirs) + test_dir("source", *subdirs) end def clear_dest FileUtils.rm_rf(dest_dir) - FileUtils.rm_rf(source_dir('.jekyll-metadata')) + FileUtils.rm_rf(source_dir(".jekyll-metadata")) end def test_dir(*subdirs) @@ -124,7 +120,7 @@ class JekyllUnitTest < Minitest::Test 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.") } + File.open("#{path}/index.html", "w") { |f| f.write("I was previously generated.") } end def with_env(key, value) diff --git a/test/simplecov_custom_profile.rb b/test/simplecov_custom_profile.rb index d7f4914c..0aaec88a 100644 --- a/test/simplecov_custom_profile.rb +++ b/test/simplecov_custom_profile.rb @@ -1,10 +1,10 @@ -require 'simplecov' +require "simplecov" -SimpleCov.profiles.define 'gem' do - add_filter '/test/' - add_filter '/features/' - add_filter '/autotest/' +SimpleCov.profiles.define "gem" do + add_filter "/test/" + add_filter "/features/" + add_filter "/autotest/" - add_group 'Binaries', '/bin/' - add_group 'Libraries', '/lib/' + add_group "Binaries", "/bin/" + add_group "Libraries", "/lib/" end diff --git a/test/test_ansi.rb b/test/test_ansi.rb index b209e237..8f18f56e 100644 --- a/test/test_ansi.rb +++ b/test/test_ansi.rb @@ -6,7 +6,7 @@ class TestAnsi < JekyllUnitTest @subject = Jekyll::Utils::Ansi end - Jekyll::Utils::Ansi::COLORS.each do |color, val| + Jekyll::Utils::Ansi::COLORS.each do |color, _val| should "respond_to? #{color}" do assert @subject.respond_to?(color) end diff --git a/test/test_cleaner.rb b/test/test_cleaner.rb index 2118c4f4..d3072e54 100644 --- a/test/test_cleaner.rb +++ b/test/test_cleaner.rb @@ -1,73 +1,73 @@ -require 'helper' +require "helper" class TestCleaner < JekyllUnitTest context "directory in keep_files" do setup do clear_dest - FileUtils.mkdir_p(dest_dir('to_keep/child_dir')) - FileUtils.touch(File.join(dest_dir('to_keep'), 'index.html')) - FileUtils.touch(File.join(dest_dir('to_keep/child_dir'), 'index.html')) + FileUtils.mkdir_p(dest_dir("to_keep/child_dir")) + FileUtils.touch(File.join(dest_dir("to_keep"), "index.html")) + FileUtils.touch(File.join(dest_dir("to_keep/child_dir"), "index.html")) @site = fixture_site - @site.keep_files = ['to_keep/child_dir'] + @site.keep_files = ["to_keep/child_dir"] @cleaner = Cleaner.new(@site) @cleaner.cleanup! end teardown do - FileUtils.rm_rf(dest_dir('to_keep')) + FileUtils.rm_rf(dest_dir("to_keep")) end should "keep the parent directory" do - assert_exist dest_dir('to_keep') + assert_exist dest_dir("to_keep") end should "keep the child directory" do - assert_exist dest_dir('to_keep', 'child_dir') + assert_exist dest_dir("to_keep", "child_dir") end should "keep the file in the directory in keep_files" do - assert_exist dest_dir('to_keep', 'child_dir', 'index.html') + assert_exist dest_dir("to_keep", "child_dir", "index.html") end should "delete the file in the directory not in keep_files" do - refute_exist dest_dir('to_keep', 'index.html') + refute_exist dest_dir("to_keep", "index.html") end end - context "not-nested directory in keep_files and similary named directory not in keep_files" do + context "non-nested directory & similarly-named directory *not* in keep_files" do setup do clear_dest - FileUtils.mkdir_p(dest_dir('.git/child_dir')) - FileUtils.mkdir_p(dest_dir('username.github.io')) - FileUtils.touch(File.join(dest_dir('.git'), 'index.html')) - FileUtils.touch(File.join(dest_dir('username.github.io'), 'index.html')) + FileUtils.mkdir_p(dest_dir(".git/child_dir")) + FileUtils.mkdir_p(dest_dir("username.github.io")) + FileUtils.touch(File.join(dest_dir(".git"), "index.html")) + FileUtils.touch(File.join(dest_dir("username.github.io"), "index.html")) @site = fixture_site - @site.keep_files = ['.git'] + @site.keep_files = [".git"] @cleaner = Cleaner.new(@site) @cleaner.cleanup! end teardown do - FileUtils.rm_rf(dest_dir('.git')) - FileUtils.rm_rf(dest_dir('username.github.io')) + FileUtils.rm_rf(dest_dir(".git")) + FileUtils.rm_rf(dest_dir("username.github.io")) end should "keep the file in the directory in keep_files" do - assert File.exist?(File.join(dest_dir('.git'), 'index.html')) + assert File.exist?(File.join(dest_dir(".git"), "index.html")) end should "delete the file in the directory not in keep_files" do - assert !File.exist?(File.join(dest_dir('username.github.io'), 'index.html')) + assert !File.exist?(File.join(dest_dir("username.github.io"), "index.html")) end should "delete the directory not in keep_files" do - assert !File.exist?(dest_dir('username.github.io')) + assert !File.exist?(dest_dir("username.github.io")) end end @@ -75,8 +75,8 @@ class TestCleaner < JekyllUnitTest setup do clear_dest - FileUtils.mkdir_p(source_dir('no_files_inside', 'child_dir')) - FileUtils.touch(source_dir('no_files_inside', 'child_dir', 'index.html')) + FileUtils.mkdir_p(source_dir("no_files_inside", "child_dir")) + FileUtils.touch(source_dir("no_files_inside", "child_dir", "index.html")) @site = fixture_site @site.process @@ -86,20 +86,20 @@ class TestCleaner < JekyllUnitTest end teardown do - FileUtils.rm_rf(source_dir('no_files_inside')) - FileUtils.rm_rf(dest_dir('no_files_inside')) + FileUtils.rm_rf(source_dir("no_files_inside")) + FileUtils.rm_rf(dest_dir("no_files_inside")) end should "keep the parent directory" do - assert_exist dest_dir('no_files_inside') + assert_exist dest_dir("no_files_inside") end should "keep the child directory" do - assert_exist dest_dir('no_files_inside', 'child_dir') + assert_exist dest_dir("no_files_inside", "child_dir") end should "keep the file" do - assert_exist source_dir('no_files_inside', 'child_dir', 'index.html') + assert_exist source_dir("no_files_inside", "child_dir", "index.html") end end end diff --git a/test/test_coffeescript.rb b/test/test_coffeescript.rb index 09c9b0a8..189ce05d 100644 --- a/test/test_coffeescript.rb +++ b/test/test_coffeescript.rb @@ -1,9 +1,9 @@ -require 'helper' +require "helper" class TestCoffeeScript < JekyllUnitTest context "converting CoffeeScript" do setup do - External.require_with_graceful_fail('jekyll-coffeescript') + External.require_with_graceful_fail("jekyll-coffeescript") @site = fixture_site @site.process @test_coffeescript_file = dest_dir("js/coffeescript.js") @@ -37,7 +37,7 @@ JS end should "write a JS file in place" do - assert_exist @test_coffeescript_file, "Can't find the converted CoffeeScript file in the dest_dir." + assert_exist @test_coffeescript_file end should "produce JS" do diff --git a/test/test_collections.rb b/test/test_collections.rb index 82175bc5..795c0d8b 100644 --- a/test/test_collections.rb +++ b/test/test_collections.rb @@ -1,4 +1,4 @@ -require 'helper' +require "helper" class TestCollections < JekyllUnitTest context "an evil collection" do @@ -50,7 +50,7 @@ class TestCollections < JekyllUnitTest end should "have a docs attribute" do - assert_equal @collection.to_liquid["docs"], Array.new + assert_equal @collection.to_liquid["docs"], [] end should "have a directory attribute" do @@ -68,9 +68,9 @@ class TestCollections < JekyllUnitTest should "know whether it should be written or not" do assert_equal @collection.write?, false - @collection.metadata['output'] = true + @collection.metadata["output"] = true assert_equal @collection.write?, true - @collection.metadata.delete 'output' + @collection.metadata.delete "output" end end @@ -80,8 +80,8 @@ class TestCollections < JekyllUnitTest @site.process end - should "contain only the defaul collections" do - refute_equal Hash.new, @site.collections + should "contain only the default collections" do + refute_equal @site.collections, {} refute_nil @site.collections end end @@ -113,7 +113,7 @@ class TestCollections < JekyllUnitTest @collection = @site.collections["methods"] end - should "create a Hash on Site with the label mapped to the instance of the Collection" do + should "create a Hash mapping label to Collection instance" do assert @site.collections.is_a?(Hash) refute_nil @site.collections["methods"] assert @site.collections["methods"].is_a? Jekyll::Collection @@ -123,7 +123,7 @@ class TestCollections < JekyllUnitTest assert @site.collections["methods"].docs.is_a? Array @site.collections["methods"].docs.each do |doc| assert doc.is_a? Jekyll::Document - assert_includes %w[ + assert_includes %w( _methods/configuration.md _methods/sanitized_path.md _methods/collection/entries @@ -132,11 +132,11 @@ class TestCollections < JekyllUnitTest _methods/um_hi.md _methods/escape-+\ #%20[].md _methods/yaml_with_dots.md - ], doc.relative_path + ), doc.relative_path end end - should "not include files which start with an underscore in the base collection directory" do + should "not include files from base dir which start with an underscore" do refute_includes @collection.filtered_entries, "_do_not_read_me.md" end @@ -146,7 +146,8 @@ class TestCollections < JekyllUnitTest should "not include the underscored files in the list of docs" do refute_includes @collection.docs.map(&:relative_path), "_methods/_do_not_read_me.md" - refute_includes @collection.docs.map(&:relative_path), "_methods/site/_dont_include_me_either.md" + refute_includes @collection.docs.map(&:relative_path), + "_methods/site/_dont_include_me_either.md" end end @@ -165,7 +166,7 @@ class TestCollections < JekyllUnitTest end should "extract the configuration collection information as metadata" do - assert_equal @collection.metadata, {"foo" => "bar", "baz" => "whoo"} + assert_equal @collection.metadata, { "foo" => "bar", "baz" => "whoo" } end end @@ -184,7 +185,7 @@ class TestCollections < JekyllUnitTest refute_includes @collection.filtered_entries, "/um_hi.md" end - should "include the symlinked file in the list of docs as it resolves to inside site.source" do + should "include the symlinked file from site.source in the list of docs" do assert_includes @collection.docs.map(&:relative_path), "_methods/um_hi.md" end end @@ -215,5 +216,4 @@ class TestCollections < JekyllUnitTest assert @collection.docs.any? { |d| d.path.include?("all.dots") } end end - end diff --git a/test/test_command.rb b/test/test_command.rb index 7d1211e8..90767013 100644 --- a/test/test_command.rb +++ b/test/test_command.rb @@ -1,4 +1,4 @@ -require 'helper' +require "helper" class TestCommand < JekyllUnitTest context "when calling .add_build_options" do diff --git a/test/test_commands_serve.rb b/test/test_commands_serve.rb index 0db8bdf9..7ffd0a57 100644 --- a/test/test_commands_serve.rb +++ b/test/test_commands_serve.rb @@ -11,7 +11,8 @@ class TestCommandsServe < JekyllUnitTest context "with a program" do setup do - @merc, @cmd = nil, Jekyll::Commands::Serve + @merc = nil + @cmd = Jekyll::Commands::Serve Mercenary.program(:jekyll) do |p| @merc = @cmd.init_with_program( p @@ -63,7 +64,7 @@ class TestCommandsServe < JekyllUnitTest should "use user port" do # WHAT?!?!1 Over 9000? That's impossible. - assert_equal 9001, custom_opts( { "port" => 9001 })[ + assert_equal 9001, custom_opts({ "port" => 9001 })[ :Port ] end @@ -104,10 +105,10 @@ class TestCommandsServe < JekyllUnitTest allow(File).to receive(:read).and_return("foo") result = custom_opts({ - "ssl_cert" => "foo", - "source" => "bar", + "ssl_cert" => "foo", + "source" => "bar", "enable_ssl" => true, - "ssl_key" => "bar" + "ssl_key" => "bar" }) assert result[:SSLEnable] diff --git a/test/test_convertible.rb b/test/test_convertible.rb index 517f5c3b..4509ed36 100644 --- a/test/test_convertible.rb +++ b/test/test_convertible.rb @@ -1,30 +1,30 @@ -require 'helper' -require 'ostruct' +require "helper" +require "ostruct" class TestConvertible < JekyllUnitTest context "yaml front-matter" do setup do @convertible = OpenStruct.new( "site" => Site.new(Jekyll.configuration( - "source" => File.expand_path('../fixtures', __FILE__) + "source" => File.expand_path("../fixtures", __FILE__) )) ) @convertible.extend Jekyll::Convertible - @base = File.expand_path('../fixtures', __FILE__) + @base = File.expand_path("../fixtures", __FILE__) end should "parse the front-matter correctly" do - ret = @convertible.read_yaml(@base, 'front_matter.erb') - assert_equal({'test' => 'good'}, ret) + ret = @convertible.read_yaml(@base, "front_matter.erb") + assert_equal({ "test" => "good" }, ret) end should "not parse if the front-matter is not at the start of the file" do - ret = @convertible.read_yaml(@base, 'broken_front_matter1.erb') + ret = @convertible.read_yaml(@base, "broken_front_matter1.erb") assert_equal({}, ret) end should "not parse if there is syntax error in front-matter" do - name = 'broken_front_matter2.erb' + name = "broken_front_matter2.erb" out = capture_stderr do ret = @convertible.read_yaml(@base, name) assert_equal({}, ret) @@ -35,15 +35,15 @@ class TestConvertible < JekyllUnitTest should "not allow ruby objects in yaml" do out = capture_stderr do - @convertible.read_yaml(@base, 'exploit_front_matter.erb') + @convertible.read_yaml(@base, "exploit_front_matter.erb") end - refute_match(/undefined class\/module DoesNotExist/, out) + refute_match(%r!undefined class\/module DoesNotExist!, out) end should "not parse if there is encoding error in file" do - name = 'broken_front_matter3.erb' + name = "broken_front_matter3.erb" out = capture_stderr do - ret = @convertible.read_yaml(@base, name, :encoding => 'utf-8') + ret = @convertible.read_yaml(@base, name, :encoding => "utf-8") assert_equal({}, ret) end assert_match(/invalid byte sequence in UTF-8/, out) @@ -51,7 +51,7 @@ class TestConvertible < JekyllUnitTest end should "parse the front-matter but show an error if permalink is empty" do - name = 'empty_permalink.erb' + name = "empty_permalink.erb" assert_raises(Errors::InvalidPermalinkError) do @convertible.read_yaml(@base, name) end @@ -59,7 +59,7 @@ class TestConvertible < JekyllUnitTest should "parse the front-matter correctly whitout permalink" do out = capture_stderr do - @convertible.read_yaml(@base, 'front_matter.erb') + @convertible.read_yaml(@base, "front_matter.erb") end refute_match(/Invalid permalink/, out) end diff --git a/test/test_doctor_command.rb b/test/test_doctor_command.rb index dee50ac2..7280b287 100644 --- a/test/test_doctor_command.rb +++ b/test/test_doctor_command.rb @@ -1,36 +1,38 @@ -require 'helper' -require 'jekyll/commands/doctor' +require "helper" +require "jekyll/commands/doctor" class TestDoctorCommand < JekyllUnitTest - context 'urls only differ by case' do + context "urls only differ by case" do setup do clear_dest end - should 'return success on a valid site/page' do + should "return success on a valid site/page" do @site = Site.new(Jekyll.configuration({ - "source" => File.join(source_dir, '/_urls_differ_by_case_valid'), + "source" => File.join(source_dir, "/_urls_differ_by_case_valid"), "destination" => dest_dir })) @site.process output = capture_stderr do - ret = Jekyll::Commands::Doctor.urls_only_differ_by_case(@site) - assert_equal false, ret + ret = Jekyll::Commands::Doctor.urls_only_differ_by_case(@site) + assert_equal false, ret end assert_equal "", output end - should 'return warning for pages only differing by case' do + should "return warning for pages only differing by case" do @site = Site.new(Jekyll.configuration({ - "source" => File.join(source_dir, '/_urls_differ_by_case_invalid'), + "source" => File.join(source_dir, "/_urls_differ_by_case_invalid"), "destination" => dest_dir })) @site.process output = capture_stderr do - ret = Jekyll::Commands::Doctor.urls_only_differ_by_case(@site) - assert_equal true, ret + ret = Jekyll::Commands::Doctor.urls_only_differ_by_case(@site) + assert_equal true, ret end - assert_includes output, "Warning: The following URLs only differ by case. On a case-insensitive file system one of the URLs will be overwritten by the other: #{dest_dir}/about/index.html, #{dest_dir}/About/index.html" + assert_includes output, "Warning: The following URLs only differ by case. "\ + "On a case-insensitive file system one of the URLs will be overwritten by the "\ + "other: #{dest_dir}/about/index.html, #{dest_dir}/About/index.html" end end end diff --git a/test/test_excerpt.rb b/test/test_excerpt.rb index 61ffded3..060323fe 100644 --- a/test/test_excerpt.rb +++ b/test/test_excerpt.rb @@ -1,22 +1,24 @@ -require 'helper' +require "helper" class TestExcerpt < JekyllUnitTest def setup_post(file) - Document.new(@site.in_source_dir(File.join('_posts', file)), { - site: @site, - collection: @site.posts + Document.new(@site.in_source_dir(File.join("_posts", file)), { + :site => @site, + :collection => @site.posts }).tap(&:read) end def do_render(document) - @site.layouts = { "default" => Layout.new(@site, source_dir('_layouts'), "simple.html")} + @site.layouts = { + "default" => Layout.new(@site, source_dir("_layouts"), "simple.html") + } document.output = Jekyll::Renderer.new(@site, document, @site.site_payload).run end context "With extraction disabled" do setup do clear_dest - @site = fixture_site('excerpt_separator' => '') + @site = fixture_site("excerpt_separator" => "") @post = setup_post("2013-07-22-post-excerpt-with-layout.markdown") end @@ -30,11 +32,10 @@ class TestExcerpt < JekyllUnitTest clear_dest @site = fixture_site @post = setup_post("2013-07-22-post-excerpt-with-layout.markdown") - @excerpt = @post.data['excerpt'] + @excerpt = @post.data["excerpt"] end context "#include(string)" do - setup do @excerpt.output = "Here is a fake output stub" end @@ -78,19 +79,22 @@ class TestExcerpt < JekyllUnitTest context "#to_liquid" do should "contain the proper page data to mimick the post liquid" do assert_equal "Post Excerpt with Layout", @excerpt.to_liquid["title"] - assert_equal "/bar/baz/z_category/mixedcase/2013/07/22/post-excerpt-with-layout.html", @excerpt.to_liquid["url"] + url = "/bar/baz/z_category/mixedcase/2013/07/22/post-excerpt-with-layout.html" + assert_equal url, @excerpt.to_liquid["url"] assert_equal Time.parse("2013-07-22"), @excerpt.to_liquid["date"] - assert_equal %w[bar baz z_category MixedCase], @excerpt.to_liquid["categories"] - assert_equal %w[first second third jekyllrb.com], @excerpt.to_liquid["tags"] - assert_equal "_posts/2013-07-22-post-excerpt-with-layout.markdown", @excerpt.to_liquid["path"] + assert_equal %w(bar baz z_category MixedCase), @excerpt.to_liquid["categories"] + assert_equal %w(first second third jekyllrb.com), @excerpt.to_liquid["tags"] + assert_equal "_posts/2013-07-22-post-excerpt-with-layout.markdown", + @excerpt.to_liquid["path"] end end context "#content" do - context "before render" do should "be the first paragraph of the page" do - assert_equal "First paragraph with [link ref][link].\n\n[link]: http://www.jekyllrb.com/", @excerpt.content + expected = "First paragraph with [link ref][link].\n\n[link]: "\ + "http://www.jekyllrb.com/" + assert_equal expected, @excerpt.content end should "contain any refs at the bottom of the page" do @@ -102,11 +106,13 @@ class TestExcerpt < JekyllUnitTest setup do @rendered_post = @post.dup do_render(@rendered_post) - @extracted_excerpt = @rendered_post.data['excerpt'] + @extracted_excerpt = @rendered_post.data["excerpt"] end should "be the first paragraph of the page" do - assert_equal "

First paragraph with link ref.

\n\n", @extracted_excerpt.output + expected = "

First paragraph with link "\ + "ref.

\n\n" + assert_equal expected, @extracted_excerpt.output end should "link properly" do @@ -121,7 +127,7 @@ class TestExcerpt < JekyllUnitTest clear_dest @site = fixture_site @post = setup_post("2008-02-02-published.markdown") - @excerpt = @post.data['excerpt'] + @excerpt = @post.data["excerpt"] end should "be generated" do diff --git a/test/test_front_matter_defaults.rb b/test/test_front_matter_defaults.rb index 8eeed7f3..f1b55ac1 100644 --- a/test/test_front_matter_defaults.rb +++ b/test/test_front_matter_defaults.rb @@ -1,14 +1,13 @@ -require 'helper' +require "helper" class TestFrontMatterDefaults < JekyllUnitTest - context "A site with full front matter defaults" do setup do @site = Site.new(Jekyll.configuration({ "source" => source_dir, "destination" => dest_dir, - "defaults" => [{ - "scope" => { + "defaults" => [{ + "scope" => { "path" => "contacts", "type" => "page" }, @@ -33,8 +32,8 @@ class TestFrontMatterDefaults < JekyllUnitTest @site = Site.new(Jekyll.configuration({ "source" => source_dir, "destination" => dest_dir, - "defaults" => [{ - "scope" => { + "defaults" => [{ + "scope" => { "path" => "index.html" }, "values" => { @@ -59,8 +58,8 @@ class TestFrontMatterDefaults < JekyllUnitTest @site = Site.new(Jekyll.configuration({ "source" => source_dir, "destination" => dest_dir, - "defaults" => [{ - "scope" => { + "defaults" => [{ + "scope" => { "path" => "win" }, "values" => { @@ -69,7 +68,7 @@ class TestFrontMatterDefaults < JekyllUnitTest }] })) @site.process - @affected = @site.posts.docs.find { |page| page.relative_path =~ /win\// } + @affected = @site.posts.docs.find { |page| page.relative_path =~ %r!win\/! } @not_affected = @site.pages.find { |page| page.relative_path == "about.html" } end @@ -84,8 +83,8 @@ class TestFrontMatterDefaults < JekyllUnitTest @site = Site.new(Jekyll.configuration({ "source" => source_dir, "destination" => dest_dir, - "defaults" => [{ - "scope" => { + "defaults" => [{ + "scope" => { "type" => "page" }, "values" => { @@ -100,7 +99,8 @@ class TestFrontMatterDefaults < JekyllUnitTest should "affect only the specified type and all paths" do assert_equal @affected.reject { |page| page.data["key"] == "val" }, [] - assert_equal @not_affected.reject { |page| page.data["key"] == "val" }, @not_affected + assert_equal @not_affected.reject { |page| page.data["key"] == "val" }, + @not_affected end end @@ -109,8 +109,8 @@ class TestFrontMatterDefaults < JekyllUnitTest @site = Site.new(Jekyll.configuration({ "source" => source_dir, "destination" => dest_dir, - "defaults" => [{ - "scope" => { + "defaults" => [{ + "scope" => { "type" => "pages" }, "values" => { @@ -125,7 +125,8 @@ class TestFrontMatterDefaults < JekyllUnitTest should "affect only the specified type and all paths" do assert_equal @affected.reject { |page| page.data["key"] == "val" }, [] - assert_equal @not_affected.reject { |page| page.data["key"] == "val" }, @not_affected + assert_equal @not_affected.reject { |page| page.data["key"] == "val" }, + @not_affected end end @@ -134,8 +135,8 @@ class TestFrontMatterDefaults < JekyllUnitTest @site = Site.new(Jekyll.configuration({ "source" => source_dir, "destination" => dest_dir, - "defaults" => [{ - "scope" => { + "defaults" => [{ + "scope" => { }, "values" => { "key" => "val" @@ -158,7 +159,7 @@ class TestFrontMatterDefaults < JekyllUnitTest @site = Site.new(Jekyll.configuration({ "source" => source_dir, "destination" => dest_dir, - "defaults" => [{ + "defaults" => [{ "values" => { "key" => "val" } @@ -180,7 +181,7 @@ class TestFrontMatterDefaults < JekyllUnitTest @site = Site.new(Jekyll.configuration({ "source" => source_dir, "destination" => dest_dir, - "defaults" => [{ + "defaults" => [{ "values" => { "date" => "2015-01-01 00:00:01" } @@ -199,5 +200,4 @@ class TestFrontMatterDefaults < JekyllUnitTest assert @site.posts.find { |page| page.data["date"] == date } end end - end diff --git a/test/test_generated_site.rb b/test/test_generated_site.rb index 301cd8f8..0a24172c 100644 --- a/test/test_generated_site.rb +++ b/test/test_generated_site.rb @@ -1,14 +1,15 @@ -require 'helper' +require "helper" class TestGeneratedSite < JekyllUnitTest context "generated sites" do setup do clear_dest - config = Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir}) + config = Jekyll::Configuration::DEFAULTS.merge({ "source" => source_dir, + "destination" => dest_dir }) @site = fixture_site(config) @site.process - @index = File.read(dest_dir('index.html')) + @index = File.read(dest_dir("index.html")) end should "ensure post count is as expected" do @@ -24,29 +25,29 @@ class TestGeneratedSite < JekyllUnitTest end should "hide unpublished posts" do - published = Dir[dest_dir('publish_test/2008/02/02/*.html')].map {|f| File.basename(f)} - + published = Dir[dest_dir("publish_test/2008/02/02/*.html")].map \ + { |f| File.basename(f) } assert_equal 1, published.size assert_equal "published.html", published.first end should "hide unpublished page" do - refute_exist dest_dir('/unpublished.html') + refute_exist dest_dir("/unpublished.html") end should "not copy _posts directory" do - refute_exist dest_dir('_posts') + refute_exist dest_dir("_posts") end should "process a page with a folder permalink properly" do - about = @site.pages.find {|page| page.name == 'about.html' } - assert_equal dest_dir('about', 'index.html'), about.destination(dest_dir) - assert_exist dest_dir('about', 'index.html') + about = @site.pages.find { |page| page.name == "about.html" } + assert_equal dest_dir("about", "index.html"), about.destination(dest_dir) + assert_exist dest_dir("about", "index.html") end should "process other static files and generate correct permalinks" do - assert_exist dest_dir('contacts.html') - assert_exist dest_dir('dynamic_file.php') + assert_exist dest_dir("contacts.html") + assert_exist dest_dir("dynamic_file.php") end should "print a nice list of static files" do @@ -57,17 +58,19 @@ class TestGeneratedSite < JekyllUnitTest - /products.yml last edited at #{time_regexp} with extname .yml - /symlink-test/symlinked-dir/screen.css last edited at #{time_regexp} with extname .css OUTPUT - assert_match expected_output, File.read(dest_dir('static_files.html')) + assert_match expected_output, File.read(dest_dir("static_files.html")) end end context "generating limited posts" do setup do clear_dest - config = Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => 5}) + config = Jekyll::Configuration::DEFAULTS.merge({ "source" => source_dir, + "destination" => dest_dir, + "limit_posts" => 5 }) @site = fixture_site(config) @site.process - @index = File.read(dest_dir('index.html')) + @index = File.read(dest_dir("index.html")) end should "generate only the specified number of posts" do @@ -78,9 +81,9 @@ OUTPUT assert_raises ArgumentError do clear_dest config = Jekyll::Configuration::DEFAULTS.merge({ - 'source' => source_dir, - 'destination' => dest_dir, - 'limit_posts' => -1 + "source" => source_dir, + "destination" => dest_dir, + "limit_posts" => -1 }) @site = fixture_site(config) end @@ -89,9 +92,9 @@ OUTPUT should "acceptable limit post is 0" do clear_dest config = Jekyll::Configuration::DEFAULTS.merge({ - 'source' => source_dir, - 'destination' => dest_dir, - 'limit_posts' => 0 + "source" => source_dir, + "destination" => dest_dir, + "limit_posts" => 0 }) assert Site.new(config), "Couldn't create a site with the given limit_posts." diff --git a/test/test_layout_reader.rb b/test/test_layout_reader.rb index 11acdb31..133cd6f2 100644 --- a/test/test_layout_reader.rb +++ b/test/test_layout_reader.rb @@ -1,9 +1,10 @@ -require 'helper' +require "helper" class TestLayoutReader < JekyllUnitTest context "reading layouts" do setup do - config = Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir}) + config = Jekyll::Configuration::DEFAULTS.merge({ "source" => source_dir, + "destination" => dest_dir }) @site = fixture_site(config) end diff --git a/test/test_liquid_extensions.rb b/test/test_liquid_extensions.rb index 0ab95e94..a76f3786 100644 --- a/test/test_liquid_extensions.rb +++ b/test/test_liquid_extensions.rb @@ -1,12 +1,11 @@ -require 'helper' +require "helper" class TestLiquidExtensions < JekyllUnitTest - context "looking up a variable in a Liquid context" do class SayHi < Liquid::Tag include Jekyll::LiquidExtensions - def initialize(tag_name, markup, tokens) + def initialize(_tag_name, markup, _tokens) @markup = markup.strip end @@ -14,18 +13,18 @@ class TestLiquidExtensions < JekyllUnitTest "hi #{lookup_variable(context, @markup)}" end end - Liquid::Template.register_tag('say_hi', SayHi) + Liquid::Template.register_tag("say_hi", SayHi) setup do - @template = Liquid::Template.parse("{% say_hi page.name %}") # Parses and compiles the template + # Parses and compiles the template + @template = Liquid::Template.parse("{% say_hi page.name %}") end should "extract the var properly" do - assert_equal @template.render({'page' => {'name' => 'tobi'}}), 'hi tobi' + assert_equal @template.render({ "page" => { "name" => "tobi" } }), "hi tobi" end should "return the variable name if the value isn't there" do - assert_equal @template.render({'page' => {'title' => 'tobi'}}), 'hi page.name' + assert_equal @template.render({ "page" => { "title" => "tobi" } }), "hi page.name" end end - end diff --git a/test/test_log_adapter.rb b/test/test_log_adapter.rb index 0160d821..7e0873ca 100644 --- a/test/test_log_adapter.rb +++ b/test/test_log_adapter.rb @@ -1,12 +1,15 @@ -require 'helper' +require "helper" class TestLogAdapter < JekyllUnitTest class LoggerDouble attr_accessor :level def debug(*); end + def info(*); end + def warn(*); end + def error(*); end end @@ -58,8 +61,9 @@ class TestLogAdapter < JekyllUnitTest should "call #debug on writer return true" do writer = LoggerDouble.new logger = Jekyll::LogAdapter.new(writer) - allow(writer).to receive(:debug).with('topic '.rjust(20) + 'log message').and_return(true) - assert logger.debug('topic', 'log message') + allow(writer).to receive(:debug) + .with("topic ".rjust(20) + "log message").and_return(true) + assert logger.debug("topic", "log message") end end @@ -67,8 +71,9 @@ class TestLogAdapter < JekyllUnitTest should "call #info on writer return true" do writer = LoggerDouble.new logger = Jekyll::LogAdapter.new(writer) - allow(writer).to receive(:info).with('topic '.rjust(20) + 'log message').and_return(true) - assert logger.info('topic', 'log message') + allow(writer).to receive(:info) + .with("topic ".rjust(20) + "log message").and_return(true) + assert logger.info("topic", "log message") end end @@ -76,8 +81,9 @@ class TestLogAdapter < JekyllUnitTest should "call #warn on writer return true" do writer = LoggerDouble.new logger = Jekyll::LogAdapter.new(writer) - allow(writer).to receive(:warn).with('topic '.rjust(20) + 'log message').and_return(true) - assert logger.warn('topic', 'log message') + allow(writer).to receive(:warn) + .with("topic ".rjust(20) + "log message").and_return(true) + assert logger.warn("topic", "log message") end end @@ -85,16 +91,17 @@ class TestLogAdapter < JekyllUnitTest should "call #error on writer return true" do writer = LoggerDouble.new logger = Jekyll::LogAdapter.new(writer) - allow(writer).to receive(:error).with('topic '.rjust(20) + 'log message').and_return(true) - assert logger.error('topic', 'log message') + allow(writer).to receive(:error) + .with("topic ".rjust(20) + "log message").and_return(true) + assert logger.error("topic", "log message") end end context "#abort_with" do should "call #error and abort" do logger = Jekyll::LogAdapter.new(LoggerDouble.new) - allow(logger).to receive(:error).with('topic', 'log message').and_return(true) - assert_raises(SystemExit) { logger.abort_with('topic', 'log message') } + allow(logger).to receive(:error).with("topic", "log message").and_return(true) + assert_raises(SystemExit) { logger.abort_with("topic", "log message") } end end @@ -105,7 +112,7 @@ class TestLogAdapter < JekyllUnitTest should "store each log value in the array" do logger = Jekyll::LogAdapter.new(LoggerDouble.new) - values = %w{one two three four} + values = %w(one two three four) logger.debug(values[0]) logger.info(values[1]) logger.warn(values[2]) diff --git a/test/test_new_command.rb b/test/test_new_command.rb index 451b525d..e0209400 100644 --- a/test/test_new_command.rb +++ b/test/test_new_command.rb @@ -1,10 +1,10 @@ -require 'helper' -require 'jekyll/commands/new' +require "helper" +require "jekyll/commands/new" class TestNewCommand < JekyllUnitTest def dir_contents(path) Dir["#{path}/**/*"].each do |file| - file.gsub! path, '' + file.gsub! path, "" end end @@ -12,9 +12,9 @@ class TestNewCommand < JekyllUnitTest File.expand_path("../lib/site_template", File.dirname(__FILE__)) end - context 'when args contains a path' do + context "when args contains a path" do setup do - @path = 'new-site' + @path = "new-site" @args = [@path] @full_path = File.expand_path(@path, Dir.pwd) end @@ -23,7 +23,7 @@ class TestNewCommand < JekyllUnitTest FileUtils.rm_r @full_path end - should 'create a new directory' do + should "create a new directory" do refute_exist @full_path Jekyll::Commands::New.process(@args) assert_exist @full_path @@ -34,43 +34,43 @@ class TestNewCommand < JekyllUnitTest refute_exist @full_path capture_stdout { Jekyll::Commands::New.process(@args) } assert_exist gemfile - assert_match /gem "jekyll", "#{Jekyll::VERSION}"/, File.read(gemfile) - assert_match /gem "github-pages"/, File.read(gemfile) + assert_match(/gem "jekyll", "#{Jekyll::VERSION}"/, File.read(gemfile)) + assert_match(/gem "github-pages"/, File.read(gemfile)) end - should 'display a success message' do + should "display a success message" do Jekyll::Commands::New.process(@args) output = Jekyll.logger.messages.last success_message = "New jekyll site installed in #{@full_path}." assert_includes output, success_message end - should 'copy the static files in site template to the new directory' do + should "copy the static files in site template to the new directory" do static_template_files = dir_contents(site_template).reject do |f| - File.extname(f) == '.erb' + File.extname(f) == ".erb" end static_template_files << "/Gemfile" capture_stdout { Jekyll::Commands::New.process(@args) } new_site_files = dir_contents(@full_path).reject do |f| - File.extname(f) == '.markdown' + File.extname(f) == ".markdown" end assert_same_elements static_template_files, new_site_files end - should 'process any ERB files' do + should "process any ERB files" do erb_template_files = dir_contents(site_template).select do |f| - File.extname(f) == '.erb' + File.extname(f) == ".erb" end - stubbed_date = '2013-01-01' + stubbed_date = "2013-01-01" allow_any_instance_of(Time).to receive(:strftime) { stubbed_date } erb_template_files.each do |f| - f.chomp! '.erb' - f.gsub! '0000-00-00', stubbed_date + f.chomp! ".erb" + f.gsub! "0000-00-00", stubbed_date end capture_stdout { Jekyll::Commands::New.process(@args) } @@ -82,22 +82,22 @@ class TestNewCommand < JekyllUnitTest assert_same_elements erb_template_files, new_site_files end - should 'create blank project' do + should "create blank project" do blank_contents = %w(/_drafts /_layouts /_posts /index.html) - capture_stdout { Jekyll::Commands::New.process(@args, '--blank') } + capture_stdout { Jekyll::Commands::New.process(@args, "--blank") } assert_same_elements blank_contents, dir_contents(@full_path) end - should 'force created folder' do + should "force created folder" do capture_stdout { Jekyll::Commands::New.process(@args) } - output = capture_stdout { Jekyll::Commands::New.process(@args, '--force') } + output = capture_stdout { Jekyll::Commands::New.process(@args, "--force") } assert_match(/New jekyll site installed in/, output) end end - context 'when multiple args are given' do + context "when multiple args are given" do setup do - @site_name_with_spaces = 'new site name' + @site_name_with_spaces = "new site name" @multiple_args = @site_name_with_spaces.split end @@ -105,23 +105,23 @@ class TestNewCommand < JekyllUnitTest FileUtils.rm_r File.expand_path(@site_name_with_spaces, Dir.pwd) end - should 'create a new directory' do + should "create a new directory" do refute_exist @site_name_with_spaces capture_stdout { Jekyll::Commands::New.process(@multiple_args) } assert_exist @site_name_with_spaces end end - context 'when no args are given' do + context "when no args are given" do setup do @empty_args = [] end - should 'raise an ArgumentError' do + should "raise an ArgumentError" do exception = assert_raises ArgumentError do Jekyll::Commands::New.process(@empty_args) end - assert_equal 'You must specify a path.', exception.message + assert_equal "You must specify a path.", exception.message end end end diff --git a/test/test_path_sanitization.rb b/test/test_path_sanitization.rb index 148103ea..df7ef172 100644 --- a/test/test_path_sanitization.rb +++ b/test/test_path_sanitization.rb @@ -1,4 +1,4 @@ -require 'helper' +require "helper" class TestPathSanitization < JekyllUnitTest context "on Windows with absolute source" do @@ -8,20 +8,24 @@ class TestPathSanitization < JekyllUnitTest allow(Dir).to receive(:pwd).and_return("C:/Users/xmr/Desktop/mpc-hc.org") end should "strip drive name from path" do - assert_equal "C:/Users/xmr/Desktop/mpc-hc.org/_site", Jekyll.sanitized_path(@source, @dest) + assert_equal "C:/Users/xmr/Desktop/mpc-hc.org/_site", + Jekyll.sanitized_path(@source, @dest) end should "strip just the initial drive name" do - assert_equal "/tmp/foobar/jail/..c:/..c:/..c:/etc/passwd", Jekyll.sanitized_path("/tmp/foobar/jail", "..c:/..c:/..c:/etc/passwd") + assert_equal "/tmp/foobar/jail/..c:/..c:/..c:/etc/passwd", + Jekyll.sanitized_path("/tmp/foobar/jail", "..c:/..c:/..c:/etc/passwd") end end should "escape tilde" do assert_equal source_dir("~hi.txt"), Jekyll.sanitized_path(source_dir, "~hi.txt") - assert_equal source_dir("files", "~hi.txt"), Jekyll.sanitized_path(source_dir, "files/../files/~hi.txt") + assert_equal source_dir("files", "~hi.txt"), + Jekyll.sanitized_path(source_dir, "files/../files/~hi.txt") end should "remove path traversals" do - assert_equal source_dir("files", "hi.txt"), Jekyll.sanitized_path(source_dir, "f./../../../../../../files/hi.txt") + assert_equal source_dir("files", "hi.txt"), + Jekyll.sanitized_path(source_dir, "f./../../../../../../files/hi.txt") end end diff --git a/test/test_plugin_manager.rb b/test/test_plugin_manager.rb index 9cdb45d8..22ad617f 100644 --- a/test/test_plugin_manager.rb +++ b/test/test_plugin_manager.rb @@ -1,4 +1,4 @@ -require 'helper' +require "helper" class TestPluginManager < JekyllUnitTest def with_no_gemfile @@ -10,14 +10,16 @@ class TestPluginManager < JekyllUnitTest def test_requiring_from_bundler with_env("JEKYLL_NO_BUNDLER_REQUIRE", nil) do - assert Jekyll::PluginManager.require_from_bundler, 'require_from_bundler should return true.' - assert ENV["JEKYLL_NO_BUNDLER_REQUIRE"], 'Gemfile plugins were not required.' + assert Jekyll::PluginManager.require_from_bundler, + "require_from_bundler should return true." + assert ENV["JEKYLL_NO_BUNDLER_REQUIRE"], "Gemfile plugins were not required." end end def test_blocking_requiring_from_bundler with_env("JEKYLL_NO_BUNDLER_REQUIRE", "true") do - assert_equal false, Jekyll::PluginManager.require_from_bundler, "Gemfile plugins were required but shouldn't have been" + assert_equal false, Jekyll::PluginManager.require_from_bundler, + "Gemfile plugins were required but shouldn't have been" assert ENV["JEKYLL_NO_BUNDLER_REQUIRE"] end end @@ -25,7 +27,8 @@ class TestPluginManager < JekyllUnitTest def test_no_gemfile with_env("JEKYLL_NO_BUNDLER_REQUIRE", nil) do with_no_gemfile do - assert_equal false, Jekyll::PluginManager.require_from_bundler, "Gemfile plugins were required but shouldn't have been" + assert_equal false, Jekyll::PluginManager.require_from_bundler, + "Gemfile plugins were required but shouldn't have been" assert_nil ENV["JEKYLL_NO_BUNDLER_REQUIRE"] end end diff --git a/test/test_rdiscount.rb b/test/test_rdiscount.rb index 96446404..9390aaed 100644 --- a/test/test_rdiscount.rb +++ b/test/test_rdiscount.rb @@ -1,7 +1,6 @@ -require 'helper' +require "helper" class TestRdiscount < JekyllUnitTest - context "rdiscount" do setup do if jruby? @@ -11,12 +10,10 @@ class TestRdiscount < JekyllUnitTest end config = { - 'markdown' => 'rdiscount', - 'rdiscount' => { - 'toc_token' => '{:toc}', - 'extensions' => [ - 'smart', 'generate_toc' - ], + "markdown" => "rdiscount", + "rdiscount" => { + "toc_token" => "{:toc}", + "extensions" => %w(smart generate_toc) } } @@ -45,7 +42,8 @@ class TestRdiscount < JekyllUnitTest

TOC - assert_equal toc.strip, @markdown.convert("# Header 1\n\n## Header 2\n\n{:toc}").strip + assert_equal toc.strip, + @markdown.convert("# Header 1\n\n## Header 2\n\n{:toc}").strip end end end diff --git a/test/test_redcarpet.rb b/test/test_redcarpet.rb index 528bc8a3..140fabbe 100644 --- a/test/test_redcarpet.rb +++ b/test/test_redcarpet.rb @@ -1,4 +1,4 @@ -require 'helper' +require "helper" class TestRedcarpet < JekyllUnitTest context "redcarpet" do @@ -10,11 +10,9 @@ class TestRedcarpet < JekyllUnitTest end @config = { - 'markdown' => 'redcarpet', - 'redcarpet' => { - 'extensions' => [ - 'smart', 'strikethrough', 'filter_html' - ] + "markdown" => "redcarpet", + "redcarpet" => { + "extensions" => %w(smart strikethrough filter_html) } } @@ -22,7 +20,7 @@ class TestRedcarpet < JekyllUnitTest end should "pass redcarpet options" do - assert_equal "

Some Header

", @markdown.convert('# Some Header #').strip + assert_equal "

Some Header

", @markdown.convert("# Some Header #").strip end should "pass redcarpet SmartyPants options" do @@ -30,58 +28,70 @@ class TestRedcarpet < JekyllUnitTest end should "pass redcarpet extensions" do - assert_equal "

deleted

", @markdown.convert('~~deleted~~').strip + assert_equal "

deleted

", @markdown.convert("~~deleted~~").strip end should "pass redcarpet render options" do - assert_equal "

bad code not here: i am bad

", @markdown.convert('**bad code not here**: ').strip + assert_equal "

bad code not here: i am bad

", + @markdown.convert("**bad code not here**: ").strip end context "with pygments enabled" do setup do - @markdown = Converters::Markdown.new @config.merge({ 'highlighter' => 'pygments' }) + @markdown = Converters::Markdown.new @config.merge( + { "highlighter" => "pygments" } + ) end should "render fenced code blocks with syntax highlighting" do - assert_equal "
puts "Hello world"\n
", @markdown.convert( - <<-EOS + assert_equal "
puts "Hello world"\n
", + @markdown.convert( + <<-EOS ```ruby puts "Hello world" ``` - EOS - ).strip +EOS + ).strip end end context "with rouge enabled" do setup do - @markdown = Converters::Markdown.new @config.merge({ 'highlighter' => 'rouge' }) + @markdown = Converters::Markdown.new @config.merge({ "highlighter" => "rouge" }) end should "render fenced code blocks with syntax highlighting" do - assert_equal "
puts \"Hello world\"\n
", @markdown.convert( - <<-EOS + assert_equal "
puts \"Hello world\"\n
", + @markdown.convert( + <<-EOS ```ruby puts "Hello world" ``` EOS - ).strip + ).strip end end context "without any highlighter" do setup do - @markdown = Converters::Markdown.new @config.merge({ 'highlighter' => nil }) + @markdown = Converters::Markdown.new @config.merge({ "highlighter" => nil }) end should "render fenced code blocks without syntax highlighting" do - assert_equal "
puts "Hello world"\n
", @markdown.convert( - <<-EOS + assert_equal "
puts "Hello world"\n
"\ + "
", + @markdown.convert( + <<-EOS ```ruby puts "Hello world" ``` EOS - ).strip + ).strip end end end