Test bulk coop report includes canceled orders

Without them numbers in the report don't match with /admin/customers and
/account where their order total is considered towards the customer
balance.
This commit is contained in:
Pau Perez
2021-03-02 17:25:12 +01:00
parent fce98da88d
commit b6ce9ca3ca

View File

@@ -18,15 +18,16 @@ describe OrderManagement::Reports::BulkCoop::BulkCoopReport do
context "as a site admin" do
it "fetches completed orders" do
o2 = create(:order)
o2 = create(:order, state: 'cart')
o2.line_items << build(:line_item)
expect(subject.table_items).to eq([li1])
end
it "does not show cancelled orders" do
o2 = create(:order, state: "canceled", completed_at: 1.day.ago)
o2.line_items << build(:line_item_with_shipment)
expect(subject.table_items).to eq([li1])
it "shows cancelled orders" do
o2 = create(:order, state: 'canceled', completed_at: 1.day.ago, order_cycle: oc1, distributor: d1)
line_item = build(:line_item_with_shipment)
o2.line_items << line_item
expect(subject.table_items).to include(line_item)
end
end