|
47 | 47 | expect(response.body).not_to include("99<br>")
|
48 | 48 | end
|
49 | 49 |
|
| 50 | + it "should show deleted items without crashing" do |
| 51 | + deleted_item = create(:item, organization: organization) |
| 52 | + travel(-1.day) do |
| 53 | + SnapshotEvent.create!( |
| 54 | + eventable: organization, |
| 55 | + organization_id: organization.id, |
| 56 | + event_time: Time.zone.now, |
| 57 | + data: EventTypes::Inventory.new( |
| 58 | + organization_id: organization.id, |
| 59 | + storage_locations: { |
| 60 | + storage_location.id => EventTypes::EventStorageLocation.new( |
| 61 | + id: storage_location.id, |
| 62 | + items: { |
| 63 | + item.id => EventTypes::EventItem.new(item_id: item.id, quantity: 0), |
| 64 | + item2.id => EventTypes::EventItem.new(item_id: item2.id, quantity: 0), |
| 65 | + deleted_item.id => EventTypes::EventItem.new(item_id: deleted_item.id, quantity: 0) |
| 66 | + } |
| 67 | + ), |
| 68 | + storage_location2.id => EventTypes::EventStorageLocation.new( |
| 69 | + id: storage_location2.id, |
| 70 | + items: { |
| 71 | + item.id => EventTypes::EventItem.new(item_id: item.id, quantity: 0), |
| 72 | + item2.id => EventTypes::EventItem.new(item_id: item2.id, quantity: 0), |
| 73 | + deleted_item.id => EventTypes::EventItem.new(item_id: deleted_item.id, quantity: 0) |
| 74 | + } |
| 75 | + ) |
| 76 | + } |
| 77 | + ) |
| 78 | + ) |
| 79 | + end |
| 80 | + deleted_id = deleted_item.id |
| 81 | + deleted_item.destroy |
| 82 | + subject |
| 83 | + expect(response.body).to include("Item1</a>") |
| 84 | + expect(response.body).to include("Item2</a>") |
| 85 | + expect(response.body).to include("Item #{deleted_id} (deleted)") |
| 86 | + end |
| 87 | + |
50 | 88 | context "with type filter" do
|
51 | 89 | let(:params) { {format: "html", filters: {by_type: "DonationEvent"}} }
|
52 | 90 |
|
|
0 commit comments