Fix overlapping error on Travis with make_visible option on attach_field spec helper

This commit is contained in:
Senén Rodero Rodríguez
2017-08-24 20:17:13 +02:00
parent f4ac8b17d0
commit d67ad6d6d0
5 changed files with 9 additions and 8 deletions

View File

@@ -197,8 +197,7 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path,
click_on "Upload document"
expect(page).to have_content "2 errors prevented this Document from being saved: "
expect(page).to have_selector "small.error:not(.show-for-sr)", text: "can't be blank", count: 2
expect(page).to have_selector "small.show-for-sr", text: "can't be blank", count: 1
expect(page).to have_selector "small.error", text: "can't be blank", count: 3
end
scenario "Should display file name after file selection", :js do

View File

@@ -105,8 +105,7 @@ shared_examples "nested documentable" do |documentable_factory_name, path, docum
click_link "Add new document"
fill_in "#{documentable_factory_name}[documents_attributes][0][title]", with: "Title"
execute_script "$('input[type=\"file\"]').removeClass('show-for-sr');"
attach_file "#{documentable_factory_name}[documents_attributes][0][attachment]", "spec/fixtures/files/empty.pdf"
attach_file("#{documentable_factory_name}[documents_attributes][0][attachment]", "spec/fixtures/files/empty.pdf", make_visible: true)
sleep 1
expect(find("##{documentable_factory_name}_documents_attributes_0_title").value).to eq "Title"
@@ -261,8 +260,7 @@ end
def attach_new_file(documentable_factory_name, index, path)
click_link "Add new document"
sleep 1
execute_script "$('input[type=\"file\"]').removeClass('show-for-sr');"
attach_file "#{documentable_factory_name}[documents_attributes][#{index}][attachment]", path
attach_file("#{documentable_factory_name}[documents_attributes][#{index}][attachment]", path, make_visible: true)
sleep 1
end