Add and apply Capybara/ClickLinkOrButtonStyle rule

This rule was added in rubocop-capybara 2.19.0. We were following it
most of the time.
This commit is contained in:
Javi Martín
2023-10-03 18:47:49 +02:00
parent 0cec581ec0
commit 5e7b5ccfd3
21 changed files with 55 additions and 52 deletions

View File

@@ -197,7 +197,7 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
visit send(mappable_edit_path, id: mappable.id)
find(".map-location").click
click_on("Save changes")
click_button "Save changes"
mappable.reload
expect(page).to have_css(".map-location")
@@ -210,7 +210,7 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
visit send(mappable_edit_path, id: mappable.id)
fill_in "#{mappable_factory_name.camelize} title", with: "New title"
click_on("Save changes")
click_button "Save changes"
mappable.reload
expect(page).to have_css(".map-location")
@@ -223,7 +223,7 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
visit send(mappable_edit_path, id: mappable.id)
click_button "Remove map marker"
click_on "Save changes"
click_button "Save changes"
expect(page).not_to have_css(".map-location")
end
@@ -234,7 +234,7 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
visit send(mappable_edit_path, id: mappable.id)
fill_in "#{mappable_factory_name.camelize} title", with: "New title"
click_on("Save changes")
click_button "Save changes"
expect(page).not_to have_css(".map-location")
end
@@ -244,7 +244,7 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
visit send(mappable_edit_path, id: mappable.id)
click_button "Remove map marker"
click_on "Save changes"
click_button "Save changes"
expect(page).not_to have_content "Map location can't be blank"
end

View File

@@ -161,7 +161,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
visit send(path, arguments)
click_link "Add new document"
click_on submit_button
click_button submit_button
within "#nested-documents .document-fields" do
expect(page).to have_content("can't be blank", count: 2)
@@ -184,7 +184,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
visit send(path, arguments)
send(fill_resource_method_name) if fill_resource_method_name
click_on submit_button
click_button submit_button
expect(page).to have_content documentable_success_notice
end
@@ -196,7 +196,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
send(fill_resource_method_name) if fill_resource_method_name
documentable_attach_new_file(file_fixture("empty.pdf"))
click_on submit_button
click_button submit_button
expect(page).to have_content documentable_success_notice
end
@@ -208,7 +208,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
send(fill_resource_method_name) if fill_resource_method_name
documentable_attach_new_file(file_fixture("empty.pdf"))
click_on submit_button
click_button submit_button
expect(page).to have_content documentable_success_notice
@@ -233,7 +233,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
documentable_attach_new_file(file_fixture("#{filename}.pdf"))
end
click_on submit_button
click_button submit_button
expect(page).to have_content documentable_success_notice
@@ -266,7 +266,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
visit send(path, arguments)
last_document = all("#nested-documents .document-fields").last
within last_document do
click_on "Remove document"
click_link "Remove document"
end
expect(page).to have_link id: "new_document_link"
@@ -276,7 +276,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
create(:document, documentable: documentable)
do_login_for user_to_login, management: management
visit send(path, arguments)
click_on "Remove document"
click_link "Remove document"
expect(page).not_to have_css ".document-fields"
end

View File

@@ -28,7 +28,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
do_login_for user, management: management
visit send(path, arguments)
click_on "Add image"
click_link "Add image"
expect(page).not_to have_css "#new_image_link"
end
@@ -117,7 +117,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
visit send(path, arguments)
click_link "Add image"
click_on submit_button
click_button submit_button
within "#nested-image .image-fields" do
expect(page).to have_content("can't be blank", count: 2)
@@ -131,7 +131,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
imageable_attach_new_file(file_fixture("clippy.jpg"))
within_fieldset("Descriptive image") { fill_in "Title", with: "" }
click_on submit_button
click_button submit_button
expect(page).to have_content "can't be blank"
expect(page).to have_css "img[src$='clippy.jpg']"
@@ -156,7 +156,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
visit send(path, arguments)
send(fill_resource_method_name) if fill_resource_method_name
click_on submit_button
click_button submit_button
expect(page).to have_content imageable_success_notice
end
@@ -169,7 +169,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
expect(page).to have_css ".loading-bar.complete"
click_on submit_button
click_button submit_button
expect(page).to have_content imageable_success_notice
end
@@ -183,7 +183,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
expect(page).to have_css ".loading-bar.complete"
click_on submit_button
click_button submit_button
expect(page).to have_content imageable_success_notice