From 918e583d0135d07fbd8850ecea28db108f33f32c Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 24 Feb 2023 16:28:58 +1100 Subject: [PATCH] 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. --- spec/models/spree/product_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/spree/product_spec.rb b/spec/models/spree/product_spec.rb index 65781c515b..ab8f3b7fcc 100644 --- a/spec/models/spree/product_spec.rb +++ b/spec/models/spree/product_spec.rb @@ -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