Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Schubert <mail@dennis-schubert.de>2022-09-20 04:14:14 +0300
committerDennis Schubert <mail@dennis-schubert.de>2022-09-20 04:20:48 +0300
commitc47258a873f26743ee9dfc099f3a7605caf4cfb7 (patch)
treec52874709b4f392a147c664c5c7db4f7b064ab19
parent6ddd16267ad44baf03d7447dc910942b3eb77f9d (diff)
Don't time travel in check_birthday_spec
-rw-r--r--spec/workers/check_birthday_spec.rb15
1 files changed, 6 insertions, 9 deletions
diff --git a/spec/workers/check_birthday_spec.rb b/spec/workers/check_birthday_spec.rb
index 1f026ab61..7f8573b79 100644
--- a/spec/workers/check_birthday_spec.rb
+++ b/spec/workers/check_birthday_spec.rb
@@ -6,15 +6,10 @@ describe Workers::CheckBirthday do
let(:contact2) { eve.contact_for(bob.person) }
before do
- Timecop.freeze(Time.zone.local(1999, 9, 9))
- birthday_profile.update(birthday: "1990-09-09")
+ birthday_profile.update(birthday: Time.zone.now)
allow(Notifications::ContactsBirthday).to receive(:notify)
end
- after do
- Timecop.return
- end
-
it "calls notify method for the birthday person's contacts" do
Workers::CheckBirthday.new.perform
expect(Notifications::ContactsBirthday).to have_received(:notify).with(contact1, [])
@@ -24,13 +19,15 @@ describe Workers::CheckBirthday do
it "does nothing if the birthday does not exist" do
birthday_profile.update(birthday: nil)
Workers::CheckBirthday.new.perform
- expect(Notifications::ContactsBirthday).not_to have_received(:notify)
+ expect(Notifications::ContactsBirthday).not_to have_received(:notify).with(contact1, [])
+ expect(Notifications::ContactsBirthday).not_to have_received(:notify).with(contact2, [])
end
it "does nothing if the person's birthday is not today" do
- birthday_profile.update(birthday: "1988-04-15")
+ birthday_profile.update(birthday: Time.zone.now - 1.day)
Workers::CheckBirthday.new.perform
- expect(Notifications::ContactsBirthday).not_to have_received(:notify)
+ expect(Notifications::ContactsBirthday).not_to have_received(:notify).with(contact1, [])
+ expect(Notifications::ContactsBirthday).not_to have_received(:notify).with(contact2, [])
end
it "does not call notify method if a person is not a contact of the birthday person" do