diff --git a/spec/factories.rb b/spec/factories.rb index 1da7e5d478..4454be4fe7 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -374,6 +374,7 @@ FactoryBot.define do shipping_method { create :shipping_method } end after(:create) do |shipment, evaluator| + shipment.shipping_rates.destroy_all # remove existing shipping_rates from shipment shipment.add_shipping_method(evaluator.shipping_method, true) end end diff --git a/spec/models/spree/adjustment_spec.rb b/spec/models/spree/adjustment_spec.rb index 114c7e7cd3..c4d8f3f786 100644 --- a/spec/models/spree/adjustment_spec.rb +++ b/spec/models/spree/adjustment_spec.rb @@ -61,11 +61,13 @@ module Spree describe "Shipment adjustments" do let(:shipping_method) { create(:shipping_method_with, :flat_rate) } let(:shipment) { create(:shipment_with, :shipping_method, shipping_method: shipping_method) } - let!(:order) { create(:order, distributor: hub, shipments: [shipment]) } + let!(:order) { create(:order, distributor: hub) } let(:hub) { create(:distributor_enterprise, charges_sales_tax: true) } let!(:line_item) { create(:line_item, order: order) } let(:adjustment) { order.adjustments(:reload).shipping.first } + before { order.shipments = [shipment] } + it "has a shipping charge of $50" do adjustment.amount.should == 50 end