mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
Fix user balance calculator spec by setting a target_shipment on line item of the order being tested
This commit is contained in:
@@ -286,7 +286,7 @@ FactoryBot.define do
|
||||
|
||||
after(:create) do |order|
|
||||
p = create(:simple_product, :distributors => [order.distributor])
|
||||
FactoryBot.create(:line_item, :order => order, :product => p)
|
||||
FactoryBot.create(:line_item_with_shipment, :order => order, :product => p)
|
||||
order.reload
|
||||
end
|
||||
end
|
||||
|
||||
@@ -11,17 +11,17 @@ module OpenFoodNetwork
|
||||
|
||||
let!(:o1) { create(:order_with_totals_and_distribution,
|
||||
user: user1, distributor: hub1,
|
||||
completed_at: 1.day.ago)
|
||||
completed_at: 1.day.ago)
|
||||
} #total=10
|
||||
let!(:o2) { create(:order_with_totals_and_distribution,
|
||||
user: user1, distributor: hub1,
|
||||
completed_at: 1.day.ago)
|
||||
completed_at: 1.day.ago)
|
||||
} #total=10
|
||||
let!(:p1) { create(:payment, order: o1, amount: 15.00,
|
||||
state: "completed")
|
||||
state: "completed")
|
||||
}
|
||||
let!(:p2) { create(:payment, order: o2, amount: 2.00,
|
||||
state: "completed")
|
||||
state: "completed")
|
||||
}
|
||||
|
||||
it "finds the correct balance for this email and enterprise" do
|
||||
@@ -32,7 +32,7 @@ module OpenFoodNetwork
|
||||
let!(:hub2) { create(:distributor_enterprise) }
|
||||
let!(:o3) { create(:order_with_totals_and_distribution,
|
||||
user: user1, distributor: hub2,
|
||||
completed_at: 1.day.ago)
|
||||
completed_at: 1.day.ago)
|
||||
} #total=10
|
||||
let!(:p3) { create(:payment, order: o3, amount: 15.00,
|
||||
state: "completed")
|
||||
|
||||
Reference in New Issue
Block a user