diff --git a/spec/factories.rb b/spec/factories.rb index 1da7e5d478..2476a91be7 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -280,7 +280,7 @@ FactoryBot.define do after(:create) { |c| c.set_preference(:per_kg, 0.5); c.save! } end - factory :order_with_totals_and_distribution, :parent => :order do #possibly called :order_with_line_items in newer Spree + factory :order_with_totals_and_distribution, parent: :order do distributor { create(:distributor_enterprise) } order_cycle { create(:simple_order_cycle) } diff --git a/spec/features/admin/reports_spec.rb b/spec/features/admin/reports_spec.rb index c930f5add4..68872d2641 100644 --- a/spec/features/admin/reports_spec.rb +++ b/spec/features/admin/reports_spec.rb @@ -112,9 +112,9 @@ feature %q{ Timecop.travel(Time.zone.local(2013, 4, 25, 14, 0, 0)) { order1.finalize! } Timecop.travel(Time.zone.local(2013, 4, 25, 15, 0, 0)) { order2.finalize! } - create(:line_item, variant: variant_1, quantity: 1, order: order1) - create(:line_item, variant: variant_2, quantity: 3, order: order1) - create(:line_item, variant: product_2.master, quantity: 3, order: order2) + create(:line_item_with_shipment, variant: variant_1, quantity: 1, order: order1) + create(:line_item_with_shipment, variant: variant_2, quantity: 3, order: order1) + create(:line_item_with_shipment, variant: product_2.master, quantity: 3, order: order2) end diff --git a/spec/lib/open_food_network/bulk_coop_report_spec.rb b/spec/lib/open_food_network/bulk_coop_report_spec.rb index 695f98359e..81ea742d07 100644 --- a/spec/lib/open_food_network/bulk_coop_report_spec.rb +++ b/spec/lib/open_food_network/bulk_coop_report_spec.rb @@ -41,7 +41,7 @@ module OpenFoodNetwork context "that has granted P-OC to the distributor" do let(:o2) { create(:order, distributor: d1, completed_at: 1.day.ago, bill_address: create(:address), ship_address: create(:address)) } - let(:li2) { build(:line_item, product: create(:simple_product, supplier: s1)) } + let(:li2) { build(:line_item_with_shipment, product: create(:simple_product, supplier: s1)) } before do o2.line_items << li2 @@ -56,7 +56,7 @@ module OpenFoodNetwork context "that has not granted P-OC to the distributor" do let(:o2) { create(:order, distributor: d1, completed_at: 1.day.ago, bill_address: create(:address), ship_address: create(:address)) } - let(:li2) { build(:line_item, product: create(:simple_product, supplier: s1)) } + let(:li2) { build(:line_item_with_shipment, product: create(:simple_product, supplier: s1)) } before do o2.line_items << li2 diff --git a/spec/lib/open_food_network/customers_report_spec.rb b/spec/lib/open_food_network/customers_report_spec.rb index 86b17cc2a6..b5ee26291b 100644 --- a/spec/lib/open_food_network/customers_report_spec.rb +++ b/spec/lib/open_food_network/customers_report_spec.rb @@ -104,7 +104,7 @@ module OpenFoodNetwork it "does not show orders through a hub that the current user does not manage" do # Given a supplier enterprise with an order for one of its products supplier.enterprise_roles.build(user: user).save - order.line_items << create(:line_item, product: product) + order.line_items << create(:line_item_with_shipment, product: product) # When I fetch orders, I should see no orders subject.should_receive(:filter).with([]).and_return([]) diff --git a/spec/lib/open_food_network/order_cycle_management_report_spec.rb b/spec/lib/open_food_network/order_cycle_management_report_spec.rb index 8c50b567a5..4fed3daadf 100644 --- a/spec/lib/open_food_network/order_cycle_management_report_spec.rb +++ b/spec/lib/open_food_network/order_cycle_management_report_spec.rb @@ -54,7 +54,7 @@ module OpenFoodNetwork it "does not show orders through a hub that the current user does not manage" do # Given a supplier enterprise with an order for one of its products supplier.enterprise_roles.create!(user: user) - order.line_items << create(:line_item, product: product) + order.line_items << create(:line_item_with_shipment, product: product) # When I fetch orders, I should see no orders subject.should_receive(:filter).with([]).and_return([]) diff --git a/spec/lib/open_food_network/orders_and_fulfillments_report_spec.rb b/spec/lib/open_food_network/orders_and_fulfillments_report_spec.rb index 949721afbd..12df9373b1 100644 --- a/spec/lib/open_food_network/orders_and_fulfillments_report_spec.rb +++ b/spec/lib/open_food_network/orders_and_fulfillments_report_spec.rb @@ -41,7 +41,7 @@ module OpenFoodNetwork context "that has granted P-OC to the distributor" do let(:o2) { create(:order, distributor: d1, completed_at: 1.day.ago, bill_address: create(:address), ship_address: create(:address)) } - let(:li2) { build(:line_item, product: create(:simple_product, supplier: s1)) } + let(:li2) { build(:line_item_with_shipment, product: create(:simple_product, supplier: s1)) } before do o2.line_items << li2 @@ -56,7 +56,7 @@ module OpenFoodNetwork context "that has not granted P-OC to the distributor" do let(:o2) { create(:order, distributor: d1, completed_at: 1.day.ago, bill_address: create(:address), ship_address: create(:address)) } - let(:li2) { build(:line_item, product: create(:simple_product, supplier: s1)) } + let(:li2) { build(:line_item_with_shipment, product: create(:simple_product, supplier: s1)) } before do o2.line_items << li2 diff --git a/spec/lib/open_food_network/packing_report_spec.rb b/spec/lib/open_food_network/packing_report_spec.rb index f6c32264b4..ba6c0a1e6c 100644 --- a/spec/lib/open_food_network/packing_report_spec.rb +++ b/spec/lib/open_food_network/packing_report_spec.rb @@ -56,7 +56,7 @@ module OpenFoodNetwork context "that has not granted P-OC to the distributor" do let(:o2) { create(:order, distributor: d1, completed_at: 1.day.ago, bill_address: create(:address), ship_address: create(:address)) } - let(:li2) { build(:line_item, product: create(:simple_product, supplier: s1)) } + let(:li2) { build(:line_item_with_shipment, product: create(:simple_product, supplier: s1)) } before do o2.line_items << li2