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

@@ -400,8 +400,8 @@ describe "Valuation budget investments" do
within("#duration") { expect(page).to have_content("12 months") }
within("#feasibility") { expect(page).to have_content("Feasible") }
expect(page).not_to have_selector "#price"
expect(page).not_to have_selector "#price_first_year"
expect(page).not_to have_css "#price"
expect(page).not_to have_css "#price_first_year"
end
scenario "Finish valuation" do
@@ -457,9 +457,9 @@ describe "Valuation budget investments" do
scenario "Valuators that are not admins cannot reopen or modify a finished valuation" do
visit edit_valuation_budget_budget_investment_path(budget, investment)
expect(page).not_to have_selector("input[id='budget_investment_feasibility_undecided']")
expect(page).not_to have_selector("textarea[id='budget_investment_unfeasibility_explanation']")
expect(page).not_to have_selector("input[name='budget_investment[valuation_finished]']")
expect(page).not_to have_css "input[id='budget_investment_feasibility_undecided']"
expect(page).not_to have_css "textarea[id='budget_investment_unfeasibility_explanation']"
expect(page).not_to have_css "input[name='budget_investment[valuation_finished]']"
expect(page).to have_content("Valuation finished")
expect(page).to have_content("Feasibility: Feasible")
expect(page).to have_content("Feasibility explanation: Explanation is explanatory")