From 269d3ced0c954fcc6ed7e9abc538a88c26ef75ee Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Tue, 8 Aug 2023 11:57:03 +0100 Subject: [PATCH] Update enterprise caching spec --- spec/models/enterprise_caching_spec.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spec/models/enterprise_caching_spec.rb b/spec/models/enterprise_caching_spec.rb index 8fab0abb17..e66063abc1 100644 --- a/spec/models/enterprise_caching_spec.rb +++ b/spec/models/enterprise_caching_spec.rb @@ -12,6 +12,7 @@ describe Enterprise do describe "with a supplied product" do let(:product) { create(:simple_product, supplier: enterprise, primary_taxon_id: taxon.id) } + let(:variant) { product.variants.first } let(:property) { product.product_properties.last } let(:producer_property) { enterprise.producer_properties.last } @@ -20,9 +21,9 @@ describe Enterprise do enterprise.set_producer_property 'Biodynamic', 'ASDF 4321' end - it "touches enterprise when a taxon on that product changes" do + it "touches enterprise when a taxon on that variant changes" do expect { - later { product.update(primary_taxon_id: taxon2.id) } + later { variant.update(primary_taxon_id: taxon2.id) } }.to change { enterprise.reload.updated_at } end @@ -47,6 +48,7 @@ describe Enterprise do describe "with a distributed product" do let(:product) { create(:simple_product, primary_taxon_id: taxon.id) } + let(:variant) { product.variants.first } let(:oc) { create(:simple_order_cycle, distributors: [enterprise], variants: [product.variants.first]) @@ -63,9 +65,9 @@ describe Enterprise do context "with an order cycle" do before { oc } - it "touches enterprise when a taxon on that product changes" do + it "touches enterprise when a taxon on that variant changes" do expect { - later { product.update(primary_taxon_id: taxon2.id) } + later { variant.update(primary_taxon_id: taxon2.id) } }.to change { enterprise.reload.updated_at } end