Files
openfoodnetwork/spec/services/search_orders_spec.rb
Maikel Linke dcb6f4676d Remove all unnecessary spec_helper require statements
The `.rspec` file is doing this for us.
2026-01-21 12:35:34 +11:00

26 lines
948 B
Ruby

# frozen_string_literal: true
RSpec.describe SearchOrders do
let!(:distributor) { create(:distributor_enterprise) }
let!(:order1) { create(:order_with_line_items, distributor:, line_items_count: 3) }
let!(:order2) { create(:order_with_line_items, distributor:, line_items_count: 2) }
let!(:order3) { create(:order_with_line_items, distributor:, line_items_count: 1) }
let!(:order_empty) { create(:order, distributor:) }
let!(:order_empty_but_complete) { create(:order, distributor:, state: :complete) }
let!(:order_empty_but_canceled) { create(:order, distributor:, state: :canceled) }
let(:enterprise_user) { distributor.owner }
describe '#orders' do
let(:params) { {} }
let(:service) { SearchOrders.new(params, enterprise_user) }
it 'returns orders' do
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