From c3327a5da0fa935536feda8bf2027ca53d4e6e4e Mon Sep 17 00:00:00 2001 From: Vicente Mendoza Date: Tue, 23 Jan 2018 16:44:45 +0100 Subject: [PATCH] rebase and fix test to attach max number of files --- spec/shared/features/nested_documentable.rb | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/spec/shared/features/nested_documentable.rb b/spec/shared/features/nested_documentable.rb index c5f29aac4..28c5a57d0 100644 --- a/spec/shared/features/nested_documentable.rb +++ b/spec/shared/features/nested_documentable.rb @@ -47,19 +47,12 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na scenario "Should show max documents warning when max documents allowed limit is reached", :js do login_as user_to_login visit send(path, arguments) - documentable.class.max_documents_allowed.times.each do - click_link "Add new document" + documentable_attach_new_file("spec/fixtures/files/empty.pdf") end - within "#nested-documents" do - find_all(".document input[type=file]", visible: true).each do |document| - attach_file(document, "spec/fixtures/files/empty.pdf", make_visible: true) - end - end - - expect(page).to have_content I18n.t 'documents.buttons.destroy_document' expect(page).to have_css ".max-documents-notice", visible: true + expect(page).to have_content 'Remove document' end scenario "Should hide max documents warning after any document removal", :js do @@ -70,7 +63,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na click_link "Add new document" end - all("a", text: "Remove document").last.click + all("a", text: "Cancel").last.click expect(page).to have_css ".max-documents-notice", visible: false end