mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Fixes error undefined 'stock_location' by adding shipment to line_items in the following specs: features/admin/reports_spec, lib/open_food_network/bulk_coop_report_spec, lib/open_food_network/customers_report_spec, lib/open_food_network/order_cycle_management_report_spec, lib/open_food_network/orders_and_fulfillments_report_spec and lib/open_food_network/packing_report_spec
This commit is contained in:
@@ -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) }
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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([])
|
||||
|
||||
@@ -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([])
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user