From 86e4dd89d5c85a04b619ee7404658213f3c16c0b Mon Sep 17 00:00:00 2001 From: Jordan Brough Date: Fri, 4 Mar 2016 11:29:04 -0700 Subject: [PATCH] Add spec for having shipment on package before calling estimator --- core/spec/models/spree/stock/coordinator_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/spec/models/spree/stock/coordinator_spec.rb b/core/spec/models/spree/stock/coordinator_spec.rb index f3b70a841ef..3ff3db3f43a 100644 --- a/core/spec/models/spree/stock/coordinator_spec.rb +++ b/core/spec/models/spree/stock/coordinator_spec.rb @@ -22,6 +22,15 @@ module Stock subject.shipments end + it 'connects the shipment before calling the estimator' do + expect_any_instance_of(Spree::Config.stock.estimator_class).to( + receive(:shipping_rates).and_call_original { |package| + expect(package.shipment).to be_present + } + ) + subject.shipments + end + it 'builds shipments' do expect(subject.shipments.size).to eq(1) end