Account for Rails 7 rounding in time spec

Storing a timestamp to the database has less accuracy than a Ruby Time
object. So `updated_at` changes after being written and loaded from the
database. Rails 7 accounts for that by rounding it in the model already
before it's written to the database. That made one spec fail.
This commit is contained in:
Maikel Linke
2023-02-24 16:28:58 +11:00
parent 6371f7eff6
commit 918e583d01

View File

@@ -309,7 +309,7 @@ module Spree
it "defaults available_on to now" do
Timecop.freeze do
product = Product.new
expect(product.available_on).to eq(Time.zone.now)
expect(product.available_on).to be_within(0.000001).of(Time.zone.now)
end
end