From 3c9c5862d11b843f668962503289ef6cef41008d Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Mon, 7 Sep 2020 13:32:32 +0100 Subject: [PATCH] Verify terms and conditions updated_at timestamp is touched every time the file name changes. We will need this to check if user already accepted the terms and conditions of this enterprise. --- .../admin/enterprises/terms_and_conditions_spec.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/features/admin/enterprises/terms_and_conditions_spec.rb b/spec/features/admin/enterprises/terms_and_conditions_spec.rb index ced7c5deea..3f862403d4 100644 --- a/spec/features/admin/enterprises/terms_and_conditions_spec.rb +++ b/spec/features/admin/enterprises/terms_and_conditions_spec.rb @@ -43,7 +43,11 @@ feature "Uploading Terms and Conditions PDF" do # Add PDF attach_file "enterprise[terms_and_conditions]", white_pdf_file_name - click_button "Update" + + Timecop.freeze(run_time = Time.zone.local(2002, 4, 13, 0, 0, 0)) do + click_button "Update" + 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!") @@ -55,6 +59,7 @@ feature "Uploading Terms and Conditions PDF" do click_button "Update" expect(page). 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']")