|
79 | 79 | end |
80 | 80 | end |
81 | 81 |
|
| 82 | + context "Scopes >" do |
| 83 | + describe "with_audits_for" do |
| 84 | + it "returns only storage locations that are used for one org" do |
| 85 | + storage_location1 = create(:storage_location, organization: organization) |
| 86 | + storage_location2 = create(:storage_location, organization: organization) |
| 87 | + create(:storage_location, organization: organization) |
| 88 | + storage_location4 = create(:storage_location, organization: create(:organization)) |
| 89 | + create(:audit, storage_location: storage_location1, organization: organization) |
| 90 | + create(:audit, storage_location: storage_location2, organization: organization) |
| 91 | + create(:audit, storage_location: storage_location4, organization: storage_location4.organization) |
| 92 | + expect(StorageLocation.with_audits_for(organization).to_a).to match_array([storage_location1, storage_location2]) |
| 93 | + end |
| 94 | + end |
| 95 | + |
| 96 | + describe "with_adjustments_for" do |
| 97 | + it "returns only storage locations that are used in adjustments for one org" do |
| 98 | + storage_location1 = create(:storage_location, organization: organization) |
| 99 | + storage_location2 = create(:storage_location, organization: organization) |
| 100 | + create(:storage_location, organization: organization) |
| 101 | + storage_location4 = create(:storage_location, organization: create(:organization)) |
| 102 | + create(:adjustment, storage_location: storage_location1, organization: organization) |
| 103 | + create(:adjustment, storage_location: storage_location2, organization: organization) |
| 104 | + create(:adjustment, storage_location: storage_location4, organization: storage_location4.organization) |
| 105 | + expect(StorageLocation.with_adjustments_for(organization).to_a).to match_array([storage_location1, storage_location2]) |
| 106 | + end |
| 107 | + end |
| 108 | + end |
| 109 | + |
82 | 110 | context "Methods >" do |
83 | 111 | let(:item) { create(:item) } |
84 | 112 | subject { create(:storage_location, :with_items, item_quantity: 10, item: item, organization: organization) } |
|
0 commit comments