test: fix flaky test due to passing time
This commit is contained in:
parent
f57be9e455
commit
c0f9b8c1cd
1 changed files with 3 additions and 1 deletions
|
@ -75,6 +75,8 @@ RSpec.describe ApplicationMailer, type: :mailer do
|
|||
let(:user1) { create(:user) }
|
||||
let(:user2) { create(:user, email: "your@email.com") }
|
||||
|
||||
before { freeze_time }
|
||||
|
||||
it 'creates a new EmailEvent record with the correct information' do
|
||||
expect { UserMailer.ask_for_merge(user1, user2.email).deliver_now }.to change { EmailEvent.count }.by(2)
|
||||
event = EmailEvent.last
|
||||
|
@ -83,7 +85,7 @@ RSpec.describe ApplicationMailer, type: :mailer do
|
|||
expect(event.to).to eq("your@email.com")
|
||||
expect(event.method).to eq("test")
|
||||
expect(event.subject).to eq('Fusion de compte')
|
||||
expect(event.processed_at).to be_within(1.second).of(Time.zone.now)
|
||||
expect(event.processed_at).to eq(Time.current)
|
||||
expect(event.status).to eq('dispatched')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue