Apply (but don't add) Capybara/SpecificMatcher rule

This rule was added in rubocop-rspec 2.12.0, and we were already
following it most of the time.

However, the rule isn't working correctly in some cases, such as input
selectors, so we aren't enabling it.
This commit is contained in:
Javi Martín
2023-08-29 19:37:57 +02:00
parent c2010f9756
commit f52a86b465
5 changed files with 30 additions and 30 deletions

View File

@@ -35,6 +35,6 @@ describe Admin::Poll::Officers::OfficersComponent, :admin do
it "accepts table options" do
render_inline Admin::Poll::Officers::OfficersComponent.new(officers, class: "my-officers-table")
expect(page).to have_css "table.my-officers-table"
expect(page).to have_table class: "my-officers-table"
end
end

View File

@@ -443,7 +443,7 @@ describe "Legislation Draft Versions" do
scenario "See table as a user" do
visit legislation_process_draft_version_path(draft_version.process, draft_version)
expect(page).to have_css("table")
expect(page).to have_table
expect(page).to have_content "Roberta"
expect(page).to have_content "25"
end
@@ -454,7 +454,7 @@ describe "Legislation Draft Versions" do
visit path
click_link "Launch text editor"
expect(page).to have_css("table")
expect(page).to have_table
expect(page).to have_content "Roberta"
expect(page).to have_content "25"
end

View File

@@ -80,7 +80,7 @@ describe "Account" do
click_button "Save password"
expect(page).to have_content "Password reseted successfully"
expect(page).to have_css("a[href='javascript:window.print();']", text: "Print password")
expect(page).to have_link "Print password", href: "javascript:window.print();"
expect(page).to have_css("div.for-print-only", text: "another_new_password", visible: :hidden)
end

View File

@@ -200,7 +200,7 @@ describe "Proposals" do
click_link "Print proposals"
expect(page).to have_css(".proposal", count: 5)
expect(page).to have_css("a[href='javascript:window.print();']", text: "Print")
expect(page).to have_link "Print", href: "javascript:window.print();"
end
scenario "Filtering proposals to be printed" do

View File

@@ -19,37 +19,37 @@ describe "Votes" do
within("#debates") do
within("#debate_#{debate1.id}_votes") do
within(".in-favor") do
expect(page).to have_css("button.voted")
expect(page).not_to have_css("button.no-voted")
expect(page).to have_button class: "voted"
expect(page).not_to have_button class: "no-voted"
end
within(".against") do
expect(page).to have_css("button.no-voted")
expect(page).not_to have_css("button.voted")
expect(page).to have_button class: "no-voted"
expect(page).not_to have_button class: "voted"
end
end
within("#debate_#{debate2.id}_votes") do
within(".in-favor") do
expect(page).not_to have_css("button.voted")
expect(page).not_to have_css("button.no-voted")
expect(page).not_to have_button class: "voted"
expect(page).not_to have_button class: "no-voted"
end
within(".against") do
expect(page).not_to have_css("button.no-voted")
expect(page).not_to have_css("button.voted")
expect(page).not_to have_button class: "no-voted"
expect(page).not_to have_button class: "voted"
end
end
within("#debate_#{debate3.id}_votes") do
within(".in-favor") do
expect(page).to have_css("button.no-voted")
expect(page).not_to have_css("button.voted")
expect(page).to have_button class: "no-voted"
expect(page).not_to have_button class: "voted"
end
within(".against") do
expect(page).to have_css("button.voted")
expect(page).not_to have_css("button.no-voted")
expect(page).to have_button class: "voted"
expect(page).not_to have_button class: "no-voted"
end
end
end
@@ -63,14 +63,14 @@ describe "Votes" do
within(".in-favor") do
expect(page).to have_content "0%"
expect(page).not_to have_css("button.voted")
expect(page).not_to have_css("button.no-voted")
expect(page).not_to have_button class: "voted"
expect(page).not_to have_button class: "no-voted"
end
within(".against") do
expect(page).to have_content "0%"
expect(page).not_to have_css("button.voted")
expect(page).not_to have_css("button.no-voted")
expect(page).not_to have_button class: "voted"
expect(page).not_to have_button class: "no-voted"
end
end
@@ -81,19 +81,19 @@ describe "Votes" do
within(".in-favor") do
expect(page).to have_content "100%"
expect(page).to have_css("button.voted")
expect(page).to have_button class: "voted"
end
click_button "I disagree"
within(".in-favor") do
expect(page).to have_content "0%"
expect(page).to have_css("button.no-voted")
expect(page).to have_button class: "no-voted"
end
within(".against") do
expect(page).to have_content "100%"
expect(page).to have_css("button.voted")
expect(page).to have_button class: "voted"
end
expect(page).to have_content "1 vote"
@@ -127,12 +127,12 @@ describe "Votes" do
within(".in-favor") do
expect(page).to have_content "50%"
expect(page).to have_css("button.voted")
expect(page).to have_button class: "voted"
end
within(".against") do
expect(page).to have_content "50%"
expect(page).to have_css("button.no-voted")
expect(page).to have_button class: "no-voted"
end
end
@@ -143,12 +143,12 @@ describe "Votes" do
within(".in-favor") do
expect(page).to have_content "100%"
expect(page).to have_css("button.voted")
expect(page).to have_button class: "voted"
end
within(".against") do
expect(page).to have_content "0%"
expect(page).to have_css("button.no-voted")
expect(page).to have_button class: "no-voted"
end
expect(page).to have_content "1 vote"
@@ -163,12 +163,12 @@ describe "Votes" do
within(".in-favor") do
expect(page).to have_content "100%"
expect(page).to have_css("button.voted")
expect(page).to have_button class: "voted"
end
within(".against") do
expect(page).to have_content "0%"
expect(page).to have_css("button.no-voted")
expect(page).to have_button class: "no-voted"
end
expect(page).to have_content "1 vote"