Add and apply Capybara/VisibilityMatcher rule
This rule was added in rubocop-rspec 1.39.0. The `visible: false` option is equivalent to `visible: :all`, but we generally use it meaning `visible: :hidden` for positive expectations and `visible: :all` for negative expectations. The only exceptations are tests where we count the number of map icons present. I'm assuming in this case we care about the number of map icons independently on whether they are currently shown in the map, so I'm keeping the `visible: :all` behavior in this case.
This commit is contained in:
@@ -74,7 +74,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
|
||||
click_link "Add new document"
|
||||
within "#nested-documents" do
|
||||
document = find(".document input[type=file]", visible: false)
|
||||
document = find(".document input[type=file]", visible: :hidden)
|
||||
attach_file(
|
||||
document[:id],
|
||||
Rails.root.join("spec/fixtures/files/empty.pdf"),
|
||||
@@ -106,7 +106,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
within "#nested-documents" do
|
||||
input = find("input[name$='[title]']")
|
||||
fill_in input[:id], with: "My Title"
|
||||
document_input = find("input[type=file]", visible: false)
|
||||
document_input = find("input[type=file]", visible: :hidden)
|
||||
attach_file(
|
||||
document_input[:id],
|
||||
Rails.root.join("spec/fixtures/files/empty.pdf"),
|
||||
@@ -314,7 +314,7 @@ def documentable_attach_new_file(path, success = true)
|
||||
click_link "Add new document"
|
||||
|
||||
document = all("#new_document").last
|
||||
document_input = document.find("input[type=file]", visible: false)
|
||||
document_input = document.find("input[type=file]", visible: :hidden)
|
||||
attach_file(document_input[:id], path, make_visible: true)
|
||||
|
||||
within document do
|
||||
@@ -338,7 +338,7 @@ def expect_document_has_cached_attachment(index, extension)
|
||||
document = all(".document")[index]
|
||||
|
||||
within document do
|
||||
expect(find("input[name$='[cached_attachment]']", visible: false).value).to end_with(extension)
|
||||
expect(find("input[name$='[cached_attachment]']", visible: :hidden).value).to end_with(extension)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user