From 1d1067ebc12e0bfc70d090b7571fc189f11272c2 Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Thu, 1 Oct 2020 18:10:34 +0100 Subject: [PATCH] Add coverage to T&Cs file opening on a new tab and also for the upload timestamp now displayed in the page --- .../admin/enterprises/terms_and_conditions_spec.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/spec/features/admin/enterprises/terms_and_conditions_spec.rb b/spec/features/admin/enterprises/terms_and_conditions_spec.rb index 3f862403d4..476ea6eaad 100644 --- a/spec/features/admin/enterprises/terms_and_conditions_spec.rb +++ b/spec/features/admin/enterprises/terms_and_conditions_spec.rb @@ -16,7 +16,7 @@ feature "Uploading Terms and Conditions PDF" do visit edit_admin_enterprise_path(distributor) end - describe "images for an enterprise" do + describe "with terms and conditions to upload" do def go_to_business_details within(".side_menu") do click_link "Business Details" @@ -49,20 +49,21 @@ feature "Uploading Terms and Conditions PDF" do expect(distributor.reload.terms_and_conditions_updated_at).to eq run_time end expect(page). - to have_content("Enterprise \"#{distributor.name}\" has been successfully updated!") + to have_content "Enterprise \"#{distributor.name}\" has been successfully updated!" go_to_business_details - expect(page).to have_selector("a[href*='logo-white.pdf']") + expect(page).to have_selector "a[href*='logo-white.pdf'][target=\"_blank\"]" + expect(page).to have_content "2002-04-13 00:00:00 +1000" # Replace PDF attach_file "enterprise[terms_and_conditions]", black_pdf_file_name click_button "Update" expect(page). - to have_content("Enterprise \"#{distributor.name}\" has been successfully updated!") + to have_content "Enterprise \"#{distributor.name}\" has been successfully updated!" expect(distributor.reload.terms_and_conditions_updated_at).to_not eq run_time go_to_business_details - expect(page).to have_selector("a[href*='logo-black.pdf']") + expect(page).to have_selector "a[href*='logo-black.pdf']" end end end