Add coverage to T&Cs file opening on a new tab and also for the upload timestamp now displayed in the page

This commit is contained in:
Luis Ramos
2020-10-01 18:10:34 +01:00
parent bd4d0ba5d3
commit 1d1067ebc1

View File

@@ -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