diff --git a/.rubocop.yml b/.rubocop.yml index 588e630c..b6e5b25a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -71,7 +71,6 @@ AllCops: - features/support/formatter.rb - features/support/helpers.rb - test/test_configuration.rb - - test/test_convertible.rb - test/test_doctor_command.rb - test/test_document.rb - test/test_entry_filter.rb 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