Add and apply Capybara/RSpec/HaveSelector rule

This rule was added in rubocop-capybara 2.19.0. We were following it
about 85% of the time.

Now we won't have to check both have_css and have_selector when
searching the code.
This commit is contained in:
Javi Martín
2023-10-03 18:35:51 +02:00
parent 83f3cbc143
commit 0cec581ec0
53 changed files with 206 additions and 203 deletions

View File

@@ -16,8 +16,8 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path,
within "#documents" do
expect(page).to have_link text: document.title
expect(page).to have_selector "a[rel=nofollow]", text: document.title
expect(page).not_to have_selector "a[target=_blank]"
expect(page).to have_css "a[rel=nofollow]", text: document.title
expect(page).not_to have_css "a[target=_blank]"
end
end
@@ -121,7 +121,7 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path,
end
within "##{ActionView::RecordIdentifier.dom_id(documentable)}" do
expect(page).to have_selector "h1", text: documentable.title
expect(page).to have_css "h1", text: documentable.title
end
end
end