Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[RSpec/Capybara/SpecificMatcher] False-positive with have_table #1310

Closed
boris-petrov opened this issue Jul 3, 2022 · 1 comment · Fixed by #1311
Closed

[RSpec/Capybara/SpecificMatcher] False-positive with have_table #1310

boris-petrov opened this issue Jul 3, 2022 · 1 comment · Fixed by #1311

Comments

@boris-petrov
Copy link

expect(page).to have_css('table tbody.some-class tr:last-child')

This results in a Prefer have_table over have_css. warning however in this case I have sub-matchers and that can't be replaced with have_table.

Otherwise the rule works perfect, great work!

cc @ydah

ydah added a commit to ydah/rubocop-rspec that referenced this issue Jul 3, 2022
…atcher`

Fix: rubocop#1310

Updated to not offense in the case of non-replaceable css selectors.

```ruby
expect(page).to have_css('button body')
expect(page).to have_css('a,h1')
expect(page).to have_css('table>tr')
expect(page).to have_css('select+option')
```
ydah added a commit to ydah/rubocop-rspec that referenced this issue Jul 3, 2022
…atcher`

Fix: rubocop#1310

Updated to not offense in the case of non-replaceable css selectors.

```ruby
expect(page).to have_css('button body')
expect(page).to have_css('a,h1')
expect(page).to have_css('table>tr')
expect(page).to have_css('select+option')
```
@pirj pirj closed this as completed in #1311 Jul 3, 2022
pirj added a commit that referenced this issue Jul 3, 2022
[Fix #1310] Fix a false positive for `RSpec/Capybara/SpecificMatcher`
@bquorning
Copy link
Collaborator

Fixed v2.12.1. Thanks for reporting, @boris-petrov 🙏🏼

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants