From ba750547a268b1ea50eaa4018a8be6d9765857ea Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Tue, 3 Mar 2020 12:26:18 +0000 Subject: [PATCH] The touch process in 'belongs_to :supplier, class_name: 'Enterprise', touch: true' must have changed in rails 4 and now we need to reload the enterprise to get the new updated_at value --- spec/models/enterprise_caching_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/enterprise_caching_spec.rb b/spec/models/enterprise_caching_spec.rb index 047fc6ab02..2fe4bd3f7a 100644 --- a/spec/models/enterprise_caching_spec.rb +++ b/spec/models/enterprise_caching_spec.rb @@ -33,7 +33,7 @@ describe Enterprise do it "touches enterprise when the supplier of a product changes" do expect { product.update_attributes!(supplier: supplier2) - }.to change { enterprise.updated_at } + }.to change { enterprise.reload.updated_at } end end