Fix shipping adjustment basic test in adjustment_spec by removing extra shipping_method from test shipment

This commit is contained in:
luisramos0
2018-10-01 14:47:56 +01:00
parent f0183cd17e
commit 795441484d
2 changed files with 4 additions and 1 deletions

View File

@@ -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

View File

@@ -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