Fix user balance calculator spec by setting a target_shipment on line item of the order being tested

This commit is contained in:
luisramos0
2018-11-05 19:23:09 +00:00
parent f32e4dddb1
commit 79fcc7bce0
2 changed files with 6 additions and 6 deletions

View File

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

View File

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