Skip to content

Commit

Permalink
Fix the flaky test for spec/rubocop/capybara/description_extractor_sp…
Browse files Browse the repository at this point in the history
…ec.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 <top (required)>'

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
```
  • Loading branch information
ydah committed Aug 19, 2024
1 parent 36a9deb commit b8ba5b6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions spec/rubocop/capybara/description_extractor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def stub_cop_const(name)
end

before do
YARD::Registry.clear
stub_cop_const('Foo')
stub_cop_const('Undocumented')
end
Expand Down

0 comments on commit b8ba5b6

Please sign in to comment.