From 1f3c0dc0d494981b8374053dedae7547add4eeae Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Wed, 22 May 2024 13:01:18 -0500 Subject: [PATCH] fix(rubocop): correct lint errors (#9600) Merge pull request 9600 --- test/test_collections.rb | 8 ++++---- test/test_configuration.rb | 6 +++--- test/test_document.rb | 2 +- test/test_excerpt.rb | 14 +++++++------- test/test_excerpt_drop.rb | 8 ++++---- test/test_filters.rb | 26 +++++++++++++------------- test/test_utils.rb | 10 +++++----- 7 files changed, 37 insertions(+), 37 deletions(-) diff --git a/test/test_collections.rb b/test/test_collections.rb index 65b4b709..2aab42b4 100644 --- a/test/test_collections.rb +++ b/test/test_collections.rb @@ -121,15 +121,15 @@ class TestCollections < JekyllUnitTest end should "create a Hash mapping label to Collection instance" do - assert @site.collections.is_a?(Hash) + assert_kind_of Hash, @site.collections refute_nil @site.collections["methods"] - assert @site.collections["methods"].is_a? Jekyll::Collection + assert_kind_of Jekyll::Collection, @site.collections["methods"] end should "collects docs in an array on the Collection object" do - assert @site.collections["methods"].docs.is_a? Array + assert_kind_of Array, @site.collections["methods"].docs @site.collections["methods"].docs.each do |doc| - assert doc.is_a? Jekyll::Document + assert_kind_of Jekyll::Document, doc # rubocop:disable Style/WordArray assert_includes %w( _methods/configuration.md diff --git a/test/test_configuration.rb b/test/test_configuration.rb index 5a8f101a..344cecb3 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -154,9 +154,9 @@ class TestConfiguration < JekyllUnitTest end should "always return an array" do - assert @config.config_files(@no_override).is_a?(Array) - assert @config.config_files(@one_config_file).is_a?(Array) - assert @config.config_files(@multiple_files).is_a?(Array) + assert_kind_of Array, @config.config_files(@no_override) + assert_kind_of Array, @config.config_files(@one_config_file) + assert_kind_of Array, @config.config_files(@multiple_files) end should "return the default config path if no config files are specified" do diff --git a/test/test_document.rb b/test/test_document.rb index f5f5cce6..dd7bb5f3 100644 --- a/test/test_document.rb +++ b/test/test_document.rb @@ -524,7 +524,7 @@ class TestDocument < JekyllUnitTest end should "be a static file" do - assert @document.is_a?(StaticFile) + assert_kind_of StaticFile, @document end should "be set to write" do diff --git a/test/test_excerpt.rb b/test/test_excerpt.rb index 5a4ce0a7..6aa6fff2 100644 --- a/test/test_excerpt.rb +++ b/test/test_excerpt.rb @@ -175,7 +175,7 @@ class TestExcerpt < JekyllUnitTest end should "be generated" do - assert @excerpt.is_a?(Jekyll::Excerpt) + assert_kind_of Jekyll::Excerpt, @excerpt end context "#content" do @@ -203,7 +203,7 @@ class TestExcerpt < JekyllUnitTest should "be appended to as necessary and generated" do assert_includes @excerpt.content, "{% endraw %}" assert_includes @excerpt.content, "{% endhighlight %}" - assert @excerpt.is_a?(Jekyll::Excerpt) + assert_kind_of Jekyll::Excerpt, @excerpt end end @@ -227,7 +227,7 @@ class TestExcerpt < JekyllUnitTest assert_includes @excerpt.content, "{%\n endhighlight\n%}" refute_includes @excerpt.content, "{%\n endraw\n%}\n\n{% endraw %}" refute_includes @excerpt.content, "{%\n endhighlight\n%}\n\n{% endhighlight %}" - assert @excerpt.is_a?(Jekyll::Excerpt) + assert_kind_of Jekyll::Excerpt, @excerpt end end @@ -245,7 +245,7 @@ class TestExcerpt < JekyllUnitTest should "be appended to as necessary and generated" do assert_includes @excerpt.content, "{% endfor %}" refute_includes @excerpt.content, "{% endfor %}\n\n{% endfor %}" - assert @excerpt.is_a?(Jekyll::Excerpt) + assert_kind_of Jekyll::Excerpt, @excerpt end end @@ -263,7 +263,7 @@ class TestExcerpt < JekyllUnitTest should "not be appended to but generated as is" do assert_includes @excerpt.content, "{%- endfor -%}" refute_includes @excerpt.content, "{% endfor %}\n\n{% endfor %}" - assert @excerpt.is_a?(Jekyll::Excerpt) + assert_kind_of Jekyll::Excerpt, @excerpt end end @@ -279,7 +279,7 @@ class TestExcerpt < JekyllUnitTest should "not be appended to but generated as is" do assert_includes @excerpt.content, "{{- xyzzy -}}" - assert @excerpt.is_a?(Jekyll::Excerpt) + assert_kind_of Jekyll::Excerpt, @excerpt end end @@ -304,7 +304,7 @@ class TestExcerpt < JekyllUnitTest assert_includes @excerpt.content, "{% endunless %}" assert_includes @excerpt.content, "{% enddo_nothing %}" refute_includes @excerpt.content, "{% enddo_nothing_other %}" - assert @excerpt.is_a?(Jekyll::Excerpt) + assert_kind_of Jekyll::Excerpt, @excerpt end end end diff --git a/test/test_excerpt_drop.rb b/test/test_excerpt_drop.rb index e9e387de..7da05dd6 100644 --- a/test/test_excerpt_drop.rb +++ b/test/test_excerpt_drop.rb @@ -14,10 +14,10 @@ class TestExcerptDrop < JekyllUnitTest end should "have the right thing" do - assert @doc.is_a? Jekyll::Document - assert @doc_drop.is_a? Jekyll::Drops::DocumentDrop - assert @excerpt.is_a? Jekyll::Excerpt - assert @excerpt_drop.is_a? Jekyll::Drops::ExcerptDrop + assert_kind_of Jekyll::Document, @doc + assert_kind_of Jekyll::Drops::DocumentDrop, @doc_drop + assert_kind_of Jekyll::Excerpt, @excerpt + assert_kind_of Jekyll::Drops::ExcerptDrop, @excerpt_drop end should "not have an excerpt" do diff --git a/test/test_filters.rb b/test/test_filters.rb index 8992e76f..29c653a8 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -691,7 +691,7 @@ class TestFilters < JekyllUnitTest next_doc = actual.delete("next") refute_nil next_doc - assert next_doc.is_a?(Hash), "doc.next should be an object" + assert_kind_of Hash, next_doc, "doc.next should be an object" assert_equal expected, actual end @@ -802,22 +802,22 @@ class TestFilters < JekyllUnitTest assert_includes names, g["name"], "#{g["name"]} isn't a valid grouping." case g["name"] when "default" - assert( - g["items"].is_a?(Array), + assert_kind_of( + Array, g["items"], "The list of grouped items for 'default' is not an Array." ) # adjust array.size to ignore symlinked page in Windows qty = Utils::Platforms.really_windows? ? 4 : 5 assert_equal qty, g["items"].size when "nil" - assert( - g["items"].is_a?(Array), + assert_kind_of( + Array, g["items"], "The list of grouped items for 'nil' is not an Array." ) assert_equal 2, g["items"].size when "" - assert( - g["items"].is_a?(Array), + assert_kind_of( + Array, g["items"], "The list of grouped items for '' is not an Array." ) # adjust array.size to ignore symlinked page in Windows @@ -1306,22 +1306,22 @@ class TestFilters < JekyllUnitTest assert_includes names, g["name"], "#{g["name"]} isn't a valid grouping." case g["name"] when "DEFAULT" - assert( - g["items"].is_a?(Array), + assert_kind_of( + Array, g["items"], "The list of grouped items for 'default' is not an Array." ) # adjust array.size to ignore symlinked page in Windows qty = Utils::Platforms.really_windows? ? 4 : 5 assert_equal qty, g["items"].size when "nil" - assert( - g["items"].is_a?(Array), + assert_kind_of( + Array, g["items"], "The list of grouped items for 'nil' is not an Array." ) assert_equal 2, g["items"].size when "" - assert( - g["items"].is_a?(Array), + assert_kind_of( + Array, g["items"], "The list of grouped items for '' is not an Array." ) # adjust array.size to ignore symlinked page in Windows diff --git a/test/test_utils.rb b/test/test_utils.rb index 7f230c37..ad5b43fa 100644 --- a/test/test_utils.rb +++ b/test/test_utils.rb @@ -13,8 +13,8 @@ class TestUtils < JekyllUnitTest should "merge a drop into a hash" do data = { "page" => {} } merged = Utils.deep_merge_hashes(data, @site.site_payload) - assert merged.is_a? Hash - assert merged["site"].is_a? Drops::SiteDrop + assert_kind_of Hash, merged + assert_kind_of Drops::SiteDrop, merged["site"] assert_equal data["page"], merged["page"] end @@ -22,8 +22,8 @@ class TestUtils < JekyllUnitTest data = { "page" => {} } assert_nil @site.site_payload["page"] merged = Utils.deep_merge_hashes(@site.site_payload, data) - assert merged.is_a? Drops::UnifiedPayloadDrop - assert merged["site"].is_a? Drops::SiteDrop + assert_kind_of Drops::UnifiedPayloadDrop, merged + assert_kind_of Drops::SiteDrop, merged["site"] assert_equal data["page"], merged["page"] end end @@ -91,7 +91,7 @@ class TestUtils < JekyllUnitTest context "The \`Utils.parse_date\` method" do should "parse a properly formatted date" do - assert Utils.parse_date("2014-08-02 14:43:06 PDT").is_a? Time + assert_kind_of Time, Utils.parse_date("2014-08-02 14:43:06 PDT") end should "throw an error if the input contains no date data" do