Update test to add more case with finalized order with no line items

Those empty order but finalized must be returned by the API
This commit is contained in:
Jean-Baptiste Bellet
2021-09-23 11:06:58 +02:00
parent 78bbee49e9
commit e82e93e1cc

View File

@@ -8,6 +8,8 @@ describe SearchOrders do
let!(:order2) { create(:order_with_line_items, distributor: distributor, line_items_count: 2) }
let!(:order3) { create(:order_with_line_items, distributor: distributor, line_items_count: 1) }
let!(:order_empty) { create(:order, distributor: distributor) }
let!(:order_empty_but_complete) { create(:order, distributor: distributor, state: :complete) }
let!(:order_empty_but_canceled) { create(:order, distributor: distributor, state: :canceled) }
let(:enterprise_user) { distributor.owner }
@@ -16,7 +18,10 @@ describe SearchOrders do
let(:service) { SearchOrders.new(params, enterprise_user) }
it 'returns orders' do
expect(service.orders.count).to eq 3
expect(service.orders.count).to eq 5
service.orders.each do |order|
expect(order.id).not_to eq(order_empty.id)
end
end
end
end