style: enable new cops (#8538)

Merge pull request 8538
This commit is contained in:
Frank Taillandier 2021-01-13 00:39:41 +01:00 committed by GitHub
parent 1e34cbaee6
commit 8c8326e9ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 148 additions and 99 deletions

View File

@ -2,7 +2,10 @@
inherit_from: .rubocop_todo.yml
require:
- rubocop-minitest
- rubocop-performance
- rubocop-rake
- rubocop-rspec
- ./rubocop/jekyll
Jekyll/NoPutsAllowed:
@ -30,14 +33,14 @@ Layout/EmptyLinesAroundAttributeAccessor:
Enabled: true
Layout/EndAlignment:
Severity: error
Layout/HashAlignment:
EnforcedHashRocketStyle: table
Layout/IndentationWidth:
Severity: error
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
Layout/HashAlignment:
EnforcedHashRocketStyle: table
Layout/IndentationWidth:
Severity: error
Layout/LineLength:
Exclude:
- !ruby/regexp /features\/.*.rb/
@ -52,17 +55,23 @@ Layout/MultilineOperationIndentation:
EnforcedStyle: indented
Layout/SpaceAroundMethodCallOperator:
Enabled: true
Layout/SpaceBeforeBrackets:
Enabled: true
Layout/SpaceInsideHashLiteralBraces:
Enabled: true
Exclude:
- test/**/*.rb
Lint/AmbiguousAssignment:
Enabled: true
Lint/BinaryOperatorWithIdenticalOperands:
Enabled: true
Lint/ConstantDefinitionInBlock:
Enabled: true
Exclude:
- test/**/*.rb
Lint/DeprecatedConstants:
Enabled: true
Lint/DeprecatedOpenSSLConstant:
Enabled: true
Lint/DuplicateBranch:
@ -71,10 +80,10 @@ Lint/DuplicateElsifCondition:
Enabled: true
Lint/DuplicateRegexpCharacterClassElement:
Enabled: true
Lint/DuplicateRescueException:
Enabled: true
Lint/DuplicateRequire:
Enabled: true
Lint/DuplicateRescueException:
Enabled: true
Lint/EmptyBlock:
Enabled: true
Lint/EmptyClass:
@ -89,6 +98,8 @@ Lint/HashCompareByIdentity:
Enabled: true
Lint/IdentityComparison:
Enabled: true
Lint/LambdaWithoutLiteralBlock:
Enabled: true
Lint/MissingSuper:
Enabled: false
Lint/MixedRegexpCaptureTypes:
@ -102,6 +113,8 @@ Lint/OutOfRangeRegexpRef:
Enabled: true
Lint/RaiseException:
Enabled: true
Lint/RedundantDirGlobSort:
Enabled: true
Lint/RedundantSafeNavigation:
Enabled: true
Lint/SelfAssignment:
@ -114,6 +127,8 @@ Lint/TopLevelReturnWithArgument:
Enabled: true
Lint/TrailingCommaInAttributeDeclaration:
Enabled: true
Lint/UnexpectedBlockArity:
Enabled: true
Lint/UnmodifiedReduceAccumulator:
Enabled: true
Lint/UnreachableCode:
@ -154,14 +169,41 @@ Metrics/MethodLength:
Max: 20
Severity: error
Metrics/ModuleLength:
Max: 240
Exclude:
- lib/jekyll/filters.rb
Max: 240
Metrics/ParameterLists:
Max: 4
Metrics/PerceivedComplexity:
Max: 13
Minitest/AssertInDelta:
Enabled: true
Minitest/AssertionInLifecycleHook:
Enabled: true
Minitest/AssertKindOf:
Enabled: true
Minitest/AssertOutput:
Enabled: true
Minitest/AssertPathExists:
Enabled: true
Minitest/AssertSilent:
Enabled: true
Minitest/LiteralAsActualArgument:
Enabled: true
Minitest/TestMethodName:
Enabled: false
Minitest/MultipleAssertions:
Enabled: true
Minitest/RefuteInDelta:
Enabled: true
Minitest/RefuteKindOf:
Enabled: true
Minitest/RefutePathExists:
Enabled: true
Minitest/UnspecifiedException:
Enabled: true
Naming/FileName:
Enabled: false
Naming/HeredocDelimiterNaming:
@ -216,10 +258,6 @@ Security/YAMLLoad:
- !ruby/regexp /features\/.*.rb/
- !ruby/regexp /test\/.*.rb$/
Style/ArgumentsForwarding:
Enabled: false
Style/ArrayCoercion:
Enabled: true
Style/AccessModifierDeclarations:
Enabled: false
Style/AccessorGrouping:
@ -228,6 +266,10 @@ Style/Alias:
EnforcedStyle: prefer_alias_method
Style/AndOr:
Severity: error
Style/ArgumentsForwarding:
Enabled: false
Style/ArrayCoercion:
Enabled: true
Style/BisectedAttrAccessor:
Enabled: true
Style/CaseLikeIf:
@ -241,16 +283,18 @@ Style/CollectionCompact:
Enabled: true
Style/CombinableLoops:
Enabled: true
Style/Documentation:
Enabled: false
Style/DocumentDynamicEvalDefinition:
Enabled: true
Style/Documentation:
Enabled: false
Style/DoubleNegation:
Enabled: false
Style/ExponentialNotation:
Style/EndlessMethod:
Enabled: true
Style/ExplicitBlockArgument:
Enabled: false
Style/ExponentialNotation:
Enabled: true
Style/FormatStringToken:
Exclude:
- lib/jekyll/utils/ansi.rb
@ -266,6 +310,8 @@ Style/HashAsLastArrayItem:
Enabled: true
Style/HashEachMethods:
Enabled: true
Style/HashExcept:
Enabled: true
Style/HashLikeCase:
Enabled: true
Style/HashSyntax:
@ -292,13 +338,13 @@ Style/OptionalBooleanParameter:
Enabled: true
Style/PercentLiteralDelimiters:
PreferredDelimiters:
"%q": "{}"
"%Q": "{}"
"%W": ()
"%q": "{}"
"%r": "!!"
"%s": "()"
"%w": "()"
"%W": "()"
"%x": "()"
"%s": ()
"%w": ()
"%x": ()
Style/RedundantArgument:
Enabled: true
Style/RedundantAssignment:
@ -328,13 +374,13 @@ Style/SlicingWithRange:
Enabled: false
Style/SoleNestedConditional:
Enabled: true
Style/StringLiterals:
EnforcedStyle: double_quotes
Style/StringConcatenation:
Enabled: true
Exclude:
- lib/jekyll/commands/*.rb
- test/**/*.rb
Style/StringLiterals:
EnforcedStyle: double_quotes
Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
Style/SwapValues:

View File

@ -24,7 +24,10 @@ group :test do
gem "rspec"
gem "rspec-mocks"
gem "rubocop", "~> 1.0"
gem "rubocop-minitest"
gem "rubocop-performance"
gem "rubocop-rake"
gem "rubocop-rspec"
gem "test-dependency-theme", :path => File.expand_path("test/fixtures/test-dependency-theme", __dir__)
gem "test-theme", :path => File.expand_path("test/fixtures/test-theme", __dir__)
gem "test-theme-skinny", :path => File.expand_path("test/fixtures/test-theme-skinny", __dir__)

View File

@ -90,7 +90,7 @@ end
Correctness.new(site_docs, "redirect_from".freeze).assert!
Correctness.new(site_docs, "title".freeze).assert!
def test_property(property, meta_key)
def property(property, meta_key)
Benchmark.ips do |x|
x.config(time: 10, warmup: 5)
x.report("sort_by_property_directly with #{property} property") do

View File

@ -51,12 +51,12 @@ Minitest::Reporters.use! [
module Minitest::Assertions
def assert_exist(filename, msg = nil)
msg = message(msg) { "Expected '#{filename}' to exist" }
assert File.exist?(filename), msg
assert_path_exists(filename, msg)
end
def refute_exist(filename, msg = nil)
msg = message(msg) { "Expected '#{filename}' not to exist" }
refute File.exist?(filename), msg
refute_path_exists(filename, msg)
end
end

View File

@ -10,7 +10,7 @@ class TestAnsi < JekyllUnitTest
Jekyll::Utils::Ansi::COLORS.each_key do |color|
should "respond_to? #{color}" do
assert @subject.respond_to?(color)
assert_respond_to(@subject, color)
end
end

View File

@ -61,15 +61,15 @@ class TestCleaner < JekyllUnitTest
end
should "keep the file in the directory in keep_files" do
assert File.exist?(File.join(dest_dir(".git"), "index.html"))
assert_path_exists(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"))
refute_path_exists(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"))
refute_path_exists(dest_dir("username.github.io"))
end
end

View File

@ -68,14 +68,14 @@ class TestCollections < JekyllUnitTest
end
should "have a output attribute" do
assert_equal false, @collection.to_liquid["output"]
refute @collection.to_liquid["output"]
end
end
should "know whether it should be written or not" do
assert_equal false, @collection.write?
refute @collection.write?
@collection.metadata["output"] = true
assert_equal true, @collection.write?
assert @collection.write?
@collection.metadata.delete "output"
end
end

View File

@ -201,7 +201,7 @@ class TestCommandsServe < JekyllUnitTest
should "use empty directory index list when show_dir_listing is true" do
opts = { "show_dir_listing" => true }
assert custom_opts(opts)[:DirectoryIndex].empty?
assert_empty custom_opts(opts)[:DirectoryIndex]
end
should "keep config between build and serve" do

View File

@ -111,7 +111,7 @@ class TestConfiguration < JekyllUnitTest
should "forces posts to output" do
result = Configuration[{ "collections" => { "posts" => { "output" => false } } }]
.add_default_collections
assert_equal true, result["collections"]["posts"]["output"]
assert result["collections"]["posts"]["output"]
end
end

View File

@ -17,7 +17,7 @@ class TestDoctorCommand < JekyllUnitTest
@site.process
output = capture_stderr do
ret = Jekyll::Commands::Doctor.urls_only_differ_by_case(@site)
assert_equal false, ret
refute ret
end
assert_equal "", output
end
@ -30,7 +30,7 @@ class TestDoctorCommand < JekyllUnitTest
@site.process
output = capture_stderr do
ret = Jekyll::Commands::Doctor.urls_only_differ_by_case(@site)
assert_equal true, ret
assert 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 "\

View File

@ -39,7 +39,7 @@ class TestDocument < JekyllUnitTest
end
should "exist" do
assert !@document.nil?
refute @document.nil?
end
should "know its relative path" do
@ -63,7 +63,7 @@ class TestDocument < JekyllUnitTest
end
should "know whether it's a YAML file" do
assert_equal false, @document.yaml_file?
refute @document.yaml_file?
end
should "know its data" do
@ -507,7 +507,7 @@ class TestDocument < JekyllUnitTest
end
should "be a static file" do
assert_equal true, @document.is_a?(StaticFile)
assert @document.is_a?(StaticFile)
end
should "be set to write" do
@ -515,7 +515,7 @@ class TestDocument < JekyllUnitTest
end
should "be in the list of docs_to_write" do
assert @site.docs_to_write.include?(@document)
assert_includes @site.docs_to_write, @document
end
should "be output in the correct place" do
@ -548,7 +548,7 @@ class TestDocument < JekyllUnitTest
end
should "be output in the correct place" do
assert_equal true, File.file?(@dest_file)
assert File.file?(@dest_file)
end
end
@ -577,7 +577,7 @@ class TestDocument < JekyllUnitTest
end
should "be output in the correct place" do
assert_equal true, File.file?(@dest_file)
assert File.file?(@dest_file)
end
end

View File

@ -104,7 +104,7 @@ class TestDrop < JekyllUnitTest
end
should "fetch default boolean value correctly" do
assert_equal false, @document_drop.fetch("bar", false)
refute @document_drop.fetch("bar", false)
end
should "fetch default value from block if key is not found" do

View File

@ -131,13 +131,13 @@ class TestEntryFilter < JekyllUnitTest
end
should "return false with no glob patterns" do
assert !@filter.glob_include?([], "a.txt")
refute @filter.glob_include?([], "a.txt")
end
should "return false with all not match path" do
data = ["a*", "b?"]
assert !@filter.glob_include?(data, "ca.txt")
assert !@filter.glob_include?(data, "ba.txt")
refute @filter.glob_include?(data, "ca.txt")
refute @filter.glob_include?(data, "ba.txt")
end
should "return true with match path" do

View File

@ -42,8 +42,8 @@ class TestExcerpt < JekyllUnitTest
end
should "return true only if an excerpt output contains a specified string" do
assert @excerpt.include?("fake output")
refute @excerpt.include?("real output")
assert_includes @excerpt, "fake output"
refute_includes @excerpt, "real output"
end
end
@ -117,7 +117,7 @@ class TestExcerpt < JekyllUnitTest
end
should "contain any refs at the bottom of the page" do
assert @excerpt.content.include?("[link]: https://jekyllrb.com/")
assert_includes @excerpt.content, "[link]: https://jekyllrb.com/"
end
end
@ -135,7 +135,7 @@ class TestExcerpt < JekyllUnitTest
end
should "link properly" do
assert @extracted_excerpt.content.include?("https://jekyllrb.com/")
assert_includes @extracted_excerpt.content, "https://jekyllrb.com/"
end
end
@ -176,7 +176,7 @@ class TestExcerpt < JekyllUnitTest
end
should "be generated" do
assert_equal true, @excerpt.is_a?(Jekyll::Excerpt)
assert @excerpt.is_a?(Jekyll::Excerpt)
end
context "#content" do
@ -204,7 +204,7 @@ class TestExcerpt < JekyllUnitTest
should "be appended to as necessary and generated" do
assert_includes @excerpt.content, "{% endraw %}"
assert_includes @excerpt.content, "{% endhighlight %}"
assert_equal true, @excerpt.is_a?(Jekyll::Excerpt)
assert @excerpt.is_a?(Jekyll::Excerpt)
end
end
@ -228,7 +228,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_equal true, @excerpt.is_a?(Jekyll::Excerpt)
assert @excerpt.is_a?(Jekyll::Excerpt)
end
end
@ -246,7 +246,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_equal true, @excerpt.is_a?(Jekyll::Excerpt)
assert @excerpt.is_a?(Jekyll::Excerpt)
end
end
@ -264,7 +264,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_equal true, @excerpt.is_a?(Jekyll::Excerpt)
assert @excerpt.is_a?(Jekyll::Excerpt)
end
end
@ -280,7 +280,7 @@ class TestExcerpt < JekyllUnitTest
should "not be appended to but generated as is" do
assert_includes @excerpt.content, "{{- xyzzy -}}"
assert_equal true, @excerpt.is_a?(Jekyll::Excerpt)
assert @excerpt.is_a?(Jekyll::Excerpt)
end
end
@ -292,8 +292,8 @@ class TestExcerpt < JekyllUnitTest
@excerpt = @post.data["excerpt"]
assert_includes @post.content.split("\n\n")[0].strip, "{% continue %}"
assert_equal true, Jekyll::DoNothingBlock.ancestors.include?(Liquid::Block)
assert_equal false, Jekyll::DoNothingOther.ancestors.include?(Liquid::Block)
assert_includes Jekyll::DoNothingBlock.ancestors, Liquid::Block
refute_includes Jekyll::DoNothingOther.ancestors, Liquid::Block
assert_match "Jekyll::DoNothingBlock", Liquid::Template.tags["do_nothing"].name
assert_match "Jekyll::DoNothingOther", Liquid::Template.tags["do_nothing_other"].name
end
@ -305,7 +305,7 @@ class TestExcerpt < JekyllUnitTest
assert_includes @excerpt.content, "{% endunless %}"
assert_includes @excerpt.content, "{% enddo_nothing %}"
refute_includes @excerpt.content, "{% enddo_nothing_other %}"
assert_equal true, @excerpt.is_a?(Jekyll::Excerpt)
assert @excerpt.is_a?(Jekyll::Excerpt)
end
end
end

View File

@ -793,7 +793,7 @@ class TestFilters < JekyllUnitTest
grouping = @filter.group_by(@filter.site.pages, "layout")
names = ["default", "nil", ""]
grouping.each do |g|
assert names.include?(g["name"]), "#{g["name"]} isn't a valid grouping."
assert_includes names, g["name"], "#{g["name"]} isn't a valid grouping."
case g["name"]
when "default"
assert(
@ -940,12 +940,12 @@ class TestFilters < JekyllUnitTest
results = @filter.where(hash, "featured", "true")
assert_equal 2, results.length
assert_equal 9.2, results[0]["rating"]
assert_equal 4.7, results[1]["rating"]
assert_in_delta(9.2, results[0]["rating"])
assert_in_delta(4.7, results[1]["rating"])
results = @filter.where(hash, "rating", 4.7)
assert_equal 1, results.length
assert_equal 4.7, results[0]["rating"]
assert_in_delta(4.7, results[0]["rating"])
end
should "always return an array if the object responds to 'select'" do
@ -1023,12 +1023,12 @@ class TestFilters < JekyllUnitTest
results = @filter.where_exp(hash, "item", "item.featured == true")
assert_equal 2, results.length
assert_equal 9.2, results[0]["rating"]
assert_equal 4.7, results[1]["rating"]
assert_in_delta(9.2, results[0]["rating"])
assert_in_delta(4.7, results[1]["rating"])
results = @filter.where_exp(hash, "item", "item.rating == 4.7")
assert_equal 1, results.length
assert_equal 4.7, results[0]["rating"]
assert_in_delta(4.7, results[0]["rating"])
end
should "filter with other operators" do
@ -1172,10 +1172,10 @@ class TestFilters < JekyllUnitTest
}
result = @filter.find(hash, "featured", "true")
assert_equal 9.2, result["rating"]
assert_in_delta(9.2, result["rating"])
result = @filter.find(hash, "rating", 4.7)
assert_equal 4.7, result["rating"]
assert_in_delta(4.7, result["rating"])
end
end
@ -1238,10 +1238,10 @@ class TestFilters < JekyllUnitTest
}
result = @filter.find_exp(hash, "item", "item.featured == true")
assert_equal 9.2, result["rating"]
assert_in_delta(9.2, result["rating"])
result = @filter.find_exp(hash, "item", "item.rating == 4.7")
assert_equal 4.7, result["rating"]
assert_in_delta(4.7, result["rating"])
end
should "filter with other operators" do
@ -1285,7 +1285,7 @@ class TestFilters < JekyllUnitTest
groups = @filter.group_by_exp(@filter.site.pages, "page", "page.layout | upcase")
names = ["DEFAULT", "NIL", ""]
groups.each do |g|
assert names.include?(g["name"]), "#{g["name"]} isn't a valid grouping."
assert_includes names, g["name"], "#{g["name"]} isn't a valid grouping."
case g["name"]
when "DEFAULT"
assert(

View File

@ -126,7 +126,7 @@ class TestFrontMatterDefaults < JekyllUnitTest
end
should "affect only the specified type and all paths" do
assert_equal @affected.reject { |page| page.data["key"] == "val" }, []
assert_equal([], @affected.reject { |page| page.data["key"] == "val" })
assert_equal @not_affected.reject { |page| page.data["key"] == "val" },
@not_affected
end
@ -150,7 +150,7 @@ class TestFrontMatterDefaults < JekyllUnitTest
end
should "affect only the specified type and all paths" do
assert_equal @affected.reject { |page| page.data["key"] == "val" }, []
assert_equal([], @affected.reject { |page| page.data["key"] == "val" })
assert_equal @not_affected.reject { |page| page.data["key"] == "val" },
@not_affected
end
@ -173,8 +173,8 @@ class TestFrontMatterDefaults < JekyllUnitTest
end
should "affect all types and paths" do
assert_equal @affected.reject { |page| page.data["key"] == "val" }, []
assert_equal @not_affected.reject { |page| page.data["key"] == "val" }, []
assert_equal([], @affected.reject { |page| page.data["key"] == "val" })
assert_equal([], @not_affected.reject { |page| page.data["key"] == "val" })
end
end
@ -193,8 +193,8 @@ class TestFrontMatterDefaults < JekyllUnitTest
end
should "affect all types and paths" do
assert_equal @affected.reject { |page| page.data["key"] == "val" }, []
assert_equal @not_affected.reject { |page| page.data["key"] == "val" }, []
assert_equal([], @affected.reject { |page| page.data["key"] == "val" })
assert_equal([], @not_affected.reject { |page| page.data["key"] == "val" })
end
end

View File

@ -72,7 +72,7 @@ class TestKramdown < JekyllUnitTest
MARKDOWN
div_highlight = ">div.highlight"
selector = "div.highlighter-rouge#{div_highlight}>pre.highlight>code"
refute(result.css(selector).empty?, result.to_html)
refute_empty(result.css(selector), result.to_html)
end
context "when configured" do
@ -151,7 +151,7 @@ class TestKramdown < JekyllUnitTest
MARKDOWN
selector = "div.highlighter-coderay>div.CodeRay>div.code>pre"
refute result.css(selector).empty?
refute_empty result.css(selector)
end
should "support legacy enable_coderay... for now" do
@ -172,7 +172,7 @@ class TestKramdown < JekyllUnitTest
MARKDOWN
selector = "div.highlighter-coderay>div.CodeRay>div.code>pre"
refute result.css(selector).empty?, "pre tag should exist"
refute_empty result.css(selector), "pre tag should exist"
end
end

View File

@ -42,7 +42,7 @@ class TestPage < JekyllUnitTest
should "not published when published yaml is false" do
@page = setup_page("unpublished.html")
assert_equal false, @page.published?
refute @page.published?
end
should "create URL with non-alphabetic characters" do

View File

@ -161,7 +161,7 @@ class TestPageWithoutAFile < JekyllUnitTest
refute_exist dest_dir("physical")
refute_exist dest_dir("virtual-about")
refute File.exist?(dest_dir("virtual-about", "index.html"))
refute_path_exists(dest_dir("virtual-about", "index.html"))
end
should "be processed and written to destination when passed as "\
@ -174,7 +174,7 @@ class TestPageWithoutAFile < JekyllUnitTest
refute_exist dest_dir("physical")
assert_exist dest_dir("virtual-about")
assert File.exist?(dest_dir("virtual-about", "index.html"))
assert_path_exists(dest_dir("virtual-about", "index.html"))
assert_equal "Test Site", File.read(dest_dir("virtual-about", "index.html"))
end
end

View File

@ -84,7 +84,7 @@ class TestPluginManager < JekyllUnitTest
plugin_manager = PluginManager.new(site)
assert plugin_manager.plugin_allowed?("jemoji")
assert !plugin_manager.plugin_allowed?("not_allowed_plugin")
refute plugin_manager.plugin_allowed?("not_allowed_plugin")
end
should "not require plugin files" do

View File

@ -52,9 +52,9 @@ class TestRegenerator < JekyllUnitTest
# these should pass, since nothing has changed, and the
# loop above made sure the designations exist
assert !@regenerator.regenerate?(@page)
assert !@regenerator.regenerate?(@post)
assert !@regenerator.regenerate?(@document)
refute @regenerator.regenerate?(@page)
refute @regenerator.regenerate?(@post)
refute @regenerator.regenerate?(@document)
end
should "regenerate if destination missing" do
@ -118,7 +118,7 @@ class TestRegenerator < JekyllUnitTest
@regenerator.add_dependency(path, @layout_path)
File.rename(@layout_path, @layout_path + ".tmp")
refute File.exist?(@layout_path)
refute_path_exists(@layout_path)
@regenerator.clear_cache
assert @regenerator.regenerate?(@post)
@ -231,7 +231,7 @@ class TestRegenerator < JekyllUnitTest
@regenerator.write_metadata
@regenerator = Regenerator.new(@site)
assert !@regenerator.modified?(@path)
refute @regenerator.modified?(@path)
end
should "not regenerate if path in cache is false" do
@ -240,9 +240,9 @@ class TestRegenerator < JekyllUnitTest
@regenerator.write_metadata
@regenerator = Regenerator.new(@site)
assert !@regenerator.modified?(@path)
assert !@regenerator.cache[@path]
assert !@regenerator.modified?(@path)
refute @regenerator.modified?(@path)
refute @regenerator.cache[@path]
refute @regenerator.modified?(@path)
end
should "regenerate if path in not in metadata" do

View File

@ -24,12 +24,12 @@ class TestSass < JekyllUnitTest
should "register the SCSS converter" do
message = "SCSS converter implementation should exist."
assert !!@site.find_converter_instance(Jekyll::Converters::Scss), message
refute !@site.find_converter_instance(Jekyll::Converters::Scss), message
end
should "register the Sass converter" do
message = "Sass converter implementation should exist."
assert !!@site.find_converter_instance(Jekyll::Converters::Sass), message
refute !@site.find_converter_instance(Jekyll::Converters::Sass), message
end
end
end

View File

@ -187,7 +187,7 @@ class TestSite < JekyllUnitTest
# simulate destination file deletion
File.unlink dest
refute File.exist?(dest)
refute_path_exists(dest)
sleep 1
@site.process
@ -268,12 +268,12 @@ class TestSite < JekyllUnitTest
should "read pages with YAML front matter" do
abs_path = File.expand_path("about.html", @site.source)
assert_equal true, Utils.has_yaml_header?(abs_path)
assert Utils.has_yaml_header?(abs_path)
end
should "enforce a strict 3-dash limit on the start of the YAML front matter" do
abs_path = File.expand_path("pgp.key", @site.source)
assert_equal false, Utils.has_yaml_header?(abs_path)
refute Utils.has_yaml_header?(abs_path)
end
should "expose jekyll version to site payload" do

View File

@ -13,7 +13,7 @@ class TestSiteDrop < JekyllUnitTest
end
should "respond to `key?`" do
assert @drop.respond_to?(:key?)
assert_respond_to @drop, :key?
end
should "find a key if it's in the collection of the drop" do

View File

@ -111,7 +111,7 @@ class TestStaticFile < JekyllUnitTest
"file.html",
defaults
)
assert(!static_file.write?,
refute(static_file.write?,
"static_file.write? should return false when _config.yml sets " \
"`published: false`")
end
@ -159,7 +159,7 @@ class TestStaticFile < JekyllUnitTest
should "known if the source path is modified, when it's not" do
@static_file.write(dest_dir)
sleep 1 # wait, else the times are still the same
assert !@static_file.modified?
refute @static_file.modified?
end
should "known whether to write the file to the filesystem" do