diff --git a/spec/shared/system/nested_documentable.rb b/spec/shared/system/nested_documentable.rb index 651e32d29..43b064eaa 100644 --- a/spec/shared/system/nested_documentable.rb +++ b/spec/shared/system/nested_documentable.rb @@ -210,9 +210,6 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na click_button submit_button expect(page).to have_content documentable_success_notice - - documentable_redirected_to_resource_show_or_navigate_to - expect(page).to have_content "Documents" expect(page).to have_content "empty.pdf" @@ -235,9 +232,6 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na click_button submit_button expect(page).to have_content documentable_success_notice - - documentable_redirected_to_resource_show_or_navigate_to - expect(page).to have_content "Documents (#{documentable.class.max_documents_allowed})" end diff --git a/spec/support/common_actions/documents.rb b/spec/support/common_actions/documents.rb index 4ff31a7ed..f1dc94d56 100644 --- a/spec/support/common_actions/documents.rb +++ b/spec/support/common_actions/documents.rb @@ -1,11 +1,4 @@ module Documents - def documentable_redirected_to_resource_show_or_navigate_to - find("a", text: "Not now, go to my proposal") - click_link "Not now, go to my proposal" - rescue - nil - end - def documentable_attach_new_file(path, success = true) click_link "Add new document" @@ -28,10 +21,4 @@ module Documents expect(find("input[name$='[title]']").value).to eq title end end - - def documentable_fill_new_valid_proposal - fill_in_new_proposal_title with: "Proposal title #{rand(9999)}" - fill_in "Proposal summary", with: "Proposal summary" - check :proposal_terms_of_service - end end diff --git a/spec/system/nested_documentable_spec.rb b/spec/system/nested_documentable_spec.rb index 4c1810cef..501d3826e 100644 --- a/spec/system/nested_documentable_spec.rb +++ b/spec/system/nested_documentable_spec.rb @@ -3,7 +3,8 @@ require "rails_helper" describe "Nested documentable" do factories = [ :budget_investment, - :dashboard_action + :dashboard_action, + :proposal ] let(:factory) { factories.sample } @@ -17,18 +18,21 @@ describe "Nested documentable" do new_management_budget_investment_path(budget_id: documentable.budget_id) ].sample when :dashboard_action then new_admin_dashboard_action_path + when :proposal then new_proposal_path end end let(:submit_button_text) do case factory when :budget_investment then "Create Investment" when :dashboard_action then "Save" + when :proposal then "Create proposal" end end let(:notice_text) do case factory when :budget_investment then "Budget Investment created successfully." when :dashboard_action then "Action created successfully" + when :proposal then "Proposal created successfully" end end @@ -217,7 +221,7 @@ describe "Nested documentable" do expect(page).to have_content notice_text end - context "Budget investments" do + context "Budget investments and proposals" do let(:factory) { (factories - [:dashboard_action]).sample } scenario "Should show new document after successful creation with one uploaded file" do @@ -275,6 +279,7 @@ describe "Nested documentable" do case factory when :budget_investment then fill_budget_investment when :dashboard_action then fill_dashboard_action + when :proposal then fill_proposal end end @@ -289,6 +294,12 @@ describe "Nested documentable" do check :budget_investment_terms_of_service end + def fill_proposal + fill_in_new_proposal_title with: "Proposal title #{rand(9999)}" + fill_in "Proposal summary", with: "Proposal summary" + check :proposal_terms_of_service + end + def admin_section? path.starts_with?("/admin/") end diff --git a/spec/system/proposals_spec.rb b/spec/system/proposals_spec.rb index dc9912e05..1df049276 100644 --- a/spec/system/proposals_spec.rb +++ b/spec/system/proposals_spec.rb @@ -1297,15 +1297,6 @@ describe "Proposals" do it_behaves_like "documentable", "proposal", "proposal_path", { id: "id" } - it_behaves_like "nested documentable", - "user", - "proposal", - "new_proposal_path", - {}, - "documentable_fill_new_valid_proposal", - "Create proposal", - "Proposal created successfully" - it_behaves_like "nested documentable", "user", "proposal",