|
10 | 10 | let(:storage_location) { create(:storage_location, organization: organization) } |
11 | 11 |
|
12 | 12 | before do |
13 | | - create(:inventory_item, storage_location: storage_location, item: item_a, quantity: 3) |
14 | | - create(:inventory_item, storage_location: storage_location, item: item_b, quantity: 20) |
| 13 | + TestInventory.create_inventory(organization, { |
| 14 | + storage_location.id => { |
| 15 | + item_a.id => 3, |
| 16 | + item_b.id => 20 |
| 17 | + } |
| 18 | + }) |
15 | 19 |
|
16 | 20 | create(:item_request, request: request_1, partner_request_id: request_1.id, item: item_a, quantity: 5, request_unit: nil) |
17 | 21 | create(:item_request, request: request_2, partner_request_id: request_2.id, item: item_b, quantity: 10, request_unit: nil) |
18 | | - |
19 | | - allow_any_instance_of(RequestItemizedBreakdownService) |
20 | | - .to receive(:current_onhand_quantities) |
21 | | - .and_return({item_a.name => 3, item_b.name => 20, item_a.id => 3, item_b.id => 20}) |
22 | | - allow_any_instance_of(RequestItemizedBreakdownService) |
23 | | - .to receive(:current_onhand_minimums) |
24 | | - .and_return({item_a.name => 4, item_b.name => 8, item_a.id => 4, item_b.id => 8}) |
25 | 22 | end |
26 | 23 |
|
27 | 24 | describe "#fetch" do |
|
38 | 35 | end |
39 | 36 |
|
40 | 37 | describe "#fetch_csv" do |
41 | | - subject { service.fetch_csv } |
| 38 | + subject(:subject) { service.fetch_csv } |
42 | 39 | let(:service) { described_class.new(organization: organization, request_ids: [request_1.id, request_2.id]) } |
43 | 40 |
|
44 | 41 | it "should output the expected output but in CSV format" do |
|
0 commit comments