|
47 | 47 | expect(response.body).not_to include("99<br>")
|
48 | 48 | end
|
49 | 49 |
|
| 50 | + it "should show items in alphabetical order" do |
| 51 | + item_1 = create(:item, organization: organization, name: "Zebra") |
| 52 | + item_2 = create(:item, organization: organization, name: "apple") |
| 53 | + item_3 = create(:item, organization: organization, name: "Monkey") |
| 54 | + |
| 55 | + donation = create(:donation, :with_items, organization: organization, |
| 56 | + storage_location: storage_location, item: item_1, item_quantity: 1) |
| 57 | + create(:line_item, item: item_2, quantity: 1, itemizable: donation) |
| 58 | + create(:line_item, item: item_3, quantity: 1, itemizable: donation) |
| 59 | + |
| 60 | + DonationEvent.publish(donation) |
| 61 | + |
| 62 | + get events_path(filters: {by_type: "DonationEvent", date_range: date_range_picker_params(3.days.ago, Time.zone.tomorrow)}) |
| 63 | + |
| 64 | + td_with_items = Nokogiri::HTML(response.body).css("td").find do |td| |
| 65 | + td.inner_html.include?("/items/") |
| 66 | + end |
| 67 | + |
| 68 | + expect(td_with_items).not_to be_nil |
| 69 | + |
| 70 | + links = td_with_items.css("a").map(&:text) |
| 71 | + expect(links).to eq(links.sort_by(&:downcase)) |
| 72 | + end |
50 | 73 | it "should show deleted items on regular event without crashing" do
|
51 | 74 | deleted_item = create(:item, organization: organization)
|
52 | 75 | travel(-1.day) do
|
|
0 commit comments