From e82e93e1cce6f70523fd587fa302936f8ebe3fb6 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Thu, 23 Sep 2021 11:06:58 +0200 Subject: [PATCH] Update test to add more case with finalized order with no line items Those empty order but finalized must be returned by the API --- spec/services/search_orders_spec.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/services/search_orders_spec.rb b/spec/services/search_orders_spec.rb index e4b543aacd..0aff7d54f5 100644 --- a/spec/services/search_orders_spec.rb +++ b/spec/services/search_orders_spec.rb @@ -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