mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-07 07:36:58 +00:00
Allow fast checkout without re-accepting old terms
We did that for the shop's terms already and now do it for the platform terms as well.
This commit is contained in:
@@ -33,4 +33,22 @@ describe TermsOfServiceFile do
|
||||
expect(subject).to match /^\/system\/terms_of_service_files\/attachments.*Terms-of-service\.pdf\?\d+$/
|
||||
end
|
||||
end
|
||||
|
||||
describe ".updated_at" do
|
||||
let(:subject) { TermsOfServiceFile.updated_at }
|
||||
|
||||
it "gives the most conservative time if not known" do
|
||||
Timecop.freeze do
|
||||
expect(subject).to eq Time.zone.now
|
||||
end
|
||||
end
|
||||
|
||||
it "returns the time when the terms were last updated" do
|
||||
update_time = 1.day.ago
|
||||
file = TermsOfServiceFile.create!(attachment: pdf, updated_at: update_time)
|
||||
|
||||
# The database isn't as precise as Ruby's time and rounds.
|
||||
expect(subject).to be_within(0.001).of(update_time)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user