rubocop / rubocop-capybara

Code style checking for Capybara files.
https://docs.rubocop.org/rubocop-capybara
MIT License
38 stars 7 forks source link

[SpecificMatcher] False-negatives #119

Open boris-petrov opened 2 months ago

boris-petrov commented 2 months ago
expect(page).to have_no_css('input[placeholder="foo"]')

This is not caught but can be replaced to:

expect(page).to have_no_field(placeholder: 'foo')
boris-petrov commented 1 week ago

Other attributes should be handled too - like type:

expect(page).to have_no_css('input[type="checkbox"]')

Must be:

expect(page).to have_no_field(type: 'checkbox')

Also, the same is true for finders:

find('input[placeholder="City"]')

Should be marked as an error as it can be replaced with:

find_field(placeholder: 'City')