|
1 | 1 | RSpec.describe "StorageLocations", type: :request do |
| 2 | + include ActionView::Helpers::NumberHelper |
| 3 | + |
2 | 4 | let(:organization) { create(:organization) } |
3 | 5 | let(:user) { create(:user, organization: organization) } |
4 | 6 | let(:organization_admin) { create(:organization_admin, organization: organization) } |
|
170 | 172 | get storage_locations_path(format: response_format) |
171 | 173 | # The first address below is quoted since it contains commas |
172 | 174 | csv = <<~CSV |
173 | | - Name,Address,Square Footage,Warehouse Type,Total Inventory,A,B,C,D |
174 | | - Storage Location with Duplicate Items,"1500 Remount Road, Front Royal, VA 22630",100,Residential space used,1,0,0,1,0 |
175 | | - Storage Location with Items,123 Donation Site Way,100,Residential space used,3,1,1,1,0 |
176 | | - Storage Location with Unique Items,Smithsonian Conservation Center new,100,Residential space used,5,0,0,0,5 |
177 | | - Test Storage Location,123 Donation Site Way,100,Residential space used,0,0,0,0,0 |
178 | | - Test Storage Location 1,123 Donation Site Way,100,Residential space used,0,0,0,0,0 |
| 175 | + Name,Address,Square Footage,Warehouse Type,Total Inventory,Fair Market Value,A,B,C,D |
| 176 | + Storage Location with Duplicate Items,"1500 Remount Road, Front Royal, VA 22630",100,Residential space used,1,0.0,0,0,1,0 |
| 177 | + Storage Location with Items,123 Donation Site Way,100,Residential space used,3,0.0,1,1,1,0 |
| 178 | + Storage Location with Unique Items,Smithsonian Conservation Center new,100,Residential space used,5,0.0,0,0,0,5 |
| 179 | + Test Storage Location,123 Donation Site Way,100,Residential space used,0,0.0,0,0,0,0 |
| 180 | + Test Storage Location 1,123 Donation Site Way,100,Residential space used,0,0.0,0,0,0,0 |
179 | 181 | CSV |
180 | 182 | expect(response.body).to eq(csv) |
181 | 183 | end |
|
208 | 210 | get storage_locations_path(include_inactive_storage_locations: "1", format: response_format) |
209 | 211 |
|
210 | 212 | csv = <<~CSV |
211 | | - Name,Address,Square Footage,Warehouse Type,Total Inventory,A,B,C,D |
212 | | - Inactive Storage Location,123 Donation Site Way,100,Residential space used,3,1,1,1,0 |
213 | | - Storage Location with Duplicate Items,"1500 Remount Road, Front Royal, VA 22630",100,Residential space used,1,0,0,1,0 |
214 | | - Storage Location with Items,123 Donation Site Way,100,Residential space used,3,1,1,1,0 |
215 | | - Storage Location with Unique Items,Smithsonian Conservation Center new,100,Residential space used,5,0,0,0,5 |
216 | | - Test Storage Location,123 Donation Site Way,100,Residential space used,0,0,0,0,0 |
217 | | - Test Storage Location 1,123 Donation Site Way,100,Residential space used,0,0,0,0,0 |
| 213 | + Name,Address,Square Footage,Warehouse Type,Total Inventory,Fair Market Value,A,B,C,D |
| 214 | + Inactive Storage Location,123 Donation Site Way,100,Residential space used,3,0.0,1,1,1,0 |
| 215 | + Storage Location with Duplicate Items,"1500 Remount Road, Front Royal, VA 22630",100,Residential space used,1,0.0,0,0,1,0 |
| 216 | + Storage Location with Items,123 Donation Site Way,100,Residential space used,3,0.0,1,1,1,0 |
| 217 | + Storage Location with Unique Items,Smithsonian Conservation Center new,100,Residential space used,5,0.0,0,0,0,5 |
| 218 | + Test Storage Location,123 Donation Site Way,100,Residential space used,0,0.0,0,0,0,0 |
| 219 | + Test Storage Location 1,123 Donation Site Way,100,Residential space used,0,0.0,0,0,0,0 |
218 | 220 | CSV |
219 | 221 |
|
220 | 222 | expect(response.body).to eq(csv) |
|
414 | 416 | end |
415 | 417 | end |
416 | 418 | end |
| 419 | + |
| 420 | + it "should include the inventory total market value" do |
| 421 | + get storage_location_path(storage_location, format: response_format) |
| 422 | + expect(response).to be_successful |
| 423 | + expect(response.body).to include(number_to_currency(storage_location.inventory_total_value_in_dollars)) |
| 424 | + end |
417 | 425 | end |
418 | 426 |
|
419 | 427 | context "csv" do |
|
0 commit comments