Changed reference from order.shipping_method to order.shipments in adjustment_spec

This commit is contained in:
luisramos0
2018-09-09 23:24:19 +01:00
parent 5bcc49a61c
commit 2f1616a286
2 changed files with 12 additions and 2 deletions

View File

@@ -280,6 +280,16 @@ FactoryBot.define do
after(:create) { |c| c.set_preference(:per_kg, 0.5); c.save! }
end
factory :shipping_method_with_flat_rate, parent: :shipping_method do
calculator { Spree::Calculator::FlatRate.new(preferred_amount: 50.0) }
end
factory :shipment_with_flat_rate, parent: :shipment do
after(:create) do |shipment|
shipment.add_shipping_method(create(:shipping_method_with_flat_rate), true)
end
end
factory :order_with_totals_and_distribution, :parent => :order do #possibly called :order_with_line_items in newer Spree
distributor { create(:distributor_enterprise) }
order_cycle { create(:simple_order_cycle) }

View File

@@ -59,10 +59,10 @@ module Spree
end
describe "Shipment adjustments" do
let!(:order) { create(:order, distributor: hub, shipping_method: shipping_method) }
let!(:shipment) { create(:shipment_with_flat_rate) }
let!(:order) { create(:order, distributor: hub, shipments: [shipment]) }
let(:hub) { create(:distributor_enterprise, charges_sales_tax: true) }
let!(:line_item) { create(:line_item, order: order) }
let(:shipping_method) { create(:shipping_method, calculator: Calculator::FlatRate.new(preferred_amount: 50.0)) }
let(:adjustment) { order.adjustments(:reload).shipping.first }
it "has a shipping charge of $50" do