Skip to content

Commit

Permalink
Test timestamp in invalidate! voucher spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Splines committed Oct 8, 2024
1 parent 8f9ef78 commit cab6097
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions spec/models/voucher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,11 @@ def expiration_days(role)
it "sets the invalidated_at attribute to the current time" do
voucher = FactoryBot.create(:voucher)
expect(voucher.invalidated_at).to be_nil
voucher.invalidate!
expect(voucher.invalidated_at).not_to be_nil
frozen_time = Time.zone.now.change(nsec: 0)
Timecop.freeze(frozen_time) do
voucher.invalidate!
expect(voucher.invalidated_at).to eq(frozen_time)
end
end
end
end
Expand Down

0 comments on commit cab6097

Please sign in to comment.