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

@@ -201,8 +201,8 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
mappable.reload
expect(page).to have_css(".map-location")
expect(page).not_to have_selector(".map-location[data-marker-latitude='#{map_location.latitude}']")
expect(page).to have_selector(".map-location[data-marker-latitude='#{mappable.map_location.latitude}']")
expect(page).not_to have_css ".map-location[data-marker-latitude='#{map_location.latitude}']"
expect(page).to have_css ".map-location[data-marker-latitude='#{mappable.map_location.latitude}']"
end
scenario "Should edit mappable on #{mappable_factory_name} without change map" do
@@ -214,8 +214,8 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
mappable.reload
expect(page).to have_css(".map-location")
expect(page).to have_selector(".map-location[data-marker-latitude='#{map_location.latitude}']")
expect(page).to have_selector(".map-location[data-marker-latitude='#{mappable.map_location.latitude}']")
expect(page).to have_css ".map-location[data-marker-latitude='#{map_location.latitude}']"
expect(page).to have_css ".map-location[data-marker-latitude='#{mappable.map_location.latitude}']"
end
scenario "Can not display map on #{mappable_factory_name} edit when remove map marker" do