From b8ba5b6844f06cacb3dbb8f6ee2018fa07bec4bb Mon Sep 17 00:00:00 2001 From: ydah Date: Mon, 19 Aug 2024 16:27:58 +0900 Subject: [PATCH] Fix the flaky test for spec/rubocop/capybara/description_extractor_spec.rb ``` RuboCop::Capybara::DescriptionExtractor builds a hash of descriptions (FAILED - 1) Failures: 1) RuboCop::Capybara::DescriptionExtractor builds a hash of descriptions Failure/Error: expect(described_class.new(yardocs).to_h).to eql( 'Capybara/Foo' => { 'Description' => 'Checks foo' }, 'Capybara/Undocumented' => { 'Description' => '' } ) expected: {"Capybara/Foo"=>{"Description"=>"Checks foo"}, "Capybara/Undocumented"=>{"Description"=>""}} got: {"Capybara/AmbiguousClick"=>{"Description"=>"Specify the exact target to click on."}, "Capybara/Click..."Capybara/VisibilityMatcher"=>{"Description"=>"Checks for boolean visibility in Capybara finders."}} (compared using eql?) Diff: @@ -1,3 +1,16 @@ +"Capybara/AmbiguousClick" => {"Description"=>"Specify the exact target to click on."}, +"Capybara/ClickLinkOrButtonStyle" => {"Description"=>"Checks for methods of button or link clicks."}, +"Capybara/CurrentPathExpectation" => {"Description"=>"Checks that no expectations are set on Capybara's `current_path`."}, +"Capybara/FindAllFirst" => {"Description"=>"Enforces use of `first` instead of `all` with `first` or `[0]`."}, "Capybara/Foo" => {"Description"=>"Checks foo"}, +"Capybara/MatchStyle" => {"Description"=>"Checks for usage of deprecated style methods."}, +"Capybara/NegationMatcher" => {"Description"=>"Enforces use of `have_no_*` or `not_to` for negated expectations."}, +"Capybara/RSpec/HaveSelector" => {"Description"=>"Use `have_css` or `have_xpath` instead of `have_selector`."}, +"Capybara/RSpec/PredicateMatcher" => {"Description"=>"Prefer using predicate matcher over using predicate method directly."}, +"Capybara/RedundantWithinFind" => {"Description"=>"Checks for redundant `within find(...)` calls."}, +"Capybara/SpecificActions" => {"Description"=>"Checks for there is a more specific actions offered by Capybara."}, +"Capybara/SpecificFinders" => {"Description"=>"Checks if there is a more specific finder offered by Capybara."}, +"Capybara/SpecificMatcher" => {"Description"=>"Checks for there is a more specific matcher offered by Capybara."}, "Capybara/Undocumented" => {"Description"=>""}, +"Capybara/VisibilityMatcher" => {"Description"=>"Checks for boolean visibility in Capybara finders."}, # ./spec/rubocop/capybara/description_extractor_spec.rb:66:in `block (2 levels) in ' Finished in 0.33675 seconds (files took 0.6663 seconds to load) 381 examples, 1 failure Failed examples: rspec ./spec/rubocop/capybara/description_extractor_spec.rb:65 # RuboCop::Capybara::DescriptionExtractor builds a hash of descriptions Randomized with seed 30192 ``` --- spec/rubocop/capybara/description_extractor_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/rubocop/capybara/description_extractor_spec.rb b/spec/rubocop/capybara/description_extractor_spec.rb index 9fad89a..594558c 100644 --- a/spec/rubocop/capybara/description_extractor_spec.rb +++ b/spec/rubocop/capybara/description_extractor_spec.rb @@ -58,6 +58,7 @@ def stub_cop_const(name) end before do + YARD::Registry.clear stub_cop_const('Foo') stub_cop_const('Undocumented') end