|
15 | 15 | partner: partner2, storage_location: storage_location)
|
16 | 16 | create(:distribution, issued_at: time_zone.local(2023, 3, 17),
|
17 | 17 | partner: partner2, storage_location: storage_location)
|
| 18 | + result = described_class.calendar(@organization.id) |
| 19 | + expected = <<~ICAL |
| 20 | + BEGIN:VCALENDAR |
| 21 | + VERSION:2.0 |
| 22 | + PRODID:icalendar-ruby |
| 23 | + CALSCALE:GREGORIAN |
| 24 | + METHOD:PUBLISH |
| 25 | + BEGIN:VTIMEZONE |
| 26 | + TZID:America/New_York |
| 27 | + BEGIN:DAYLIGHT |
| 28 | + DTSTART:20220313T030000 |
| 29 | + TZOFFSETFROM:-0500 |
| 30 | + TZOFFSETTO:-0400 |
| 31 | + RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3 |
| 32 | + TZNAME:EDT |
| 33 | + END:DAYLIGHT |
| 34 | + BEGIN:STANDARD |
| 35 | + DTSTART:20221106T010000 |
| 36 | + TZOFFSETFROM:-0400 |
| 37 | + TZOFFSETTO:-0500 |
| 38 | + RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11 |
| 39 | + TZNAME:EST |
| 40 | + END:STANDARD |
| 41 | + END:VTIMEZONE |
| 42 | + BEGIN:VEVENT |
| 43 | + DTSTART;TZID=America/New_York:20220317T070000 |
| 44 | + DTEND;TZID=America/New_York:20220317T071500 |
| 45 | + LOCATION:1500 Remount Road\\, Front Royal\\, VA 22630 |
| 46 | + SUMMARY:Pickup from Partner 1 |
| 47 | + URL:https://humanessentials.app/diaper_bank/distributions/schedule |
| 48 | + END:VEVENT |
| 49 | + BEGIN:VEVENT |
| 50 | + DTSTART;TZID=America/New_York:20220217T060000 |
| 51 | + DTEND;TZID=America/New_York:20220217T061500 |
| 52 | + LOCATION:1500 Remount Road\\, Front Royal\\, VA 22630 |
| 53 | + SUMMARY:Pickup from Partner 1 |
| 54 | + URL:https://humanessentials.app/diaper_bank/distributions/schedule |
| 55 | + END:VEVENT |
| 56 | + BEGIN:VEVENT |
| 57 | + DTSTART;TZID=America/New_York:20230316T210000 |
| 58 | + DTEND;TZID=America/New_York:20230316T211500 |
| 59 | + LOCATION:1500 Remount Road\\, Front Royal\\, VA 22630 |
| 60 | + SUMMARY:Pickup from Partner 2 |
| 61 | + URL:https://humanessentials.app/diaper_bank/distributions/schedule |
| 62 | + END:VEVENT |
| 63 | + END:VCALENDAR |
| 64 | + ICAL |
| 65 | + # remove nondeterministic values and replace \n with \r\n |
| 66 | + result = result.gsub(/\r\nDTSTAMP:.*\r\n/, "\r\n").gsub(/\r\nUID:.*\r\n/, "\r\n") |
| 67 | + expect(result).to eq(expected.gsub("\n", "\r\n")) |
18 | 68 | end
|
19 |
| - result = described_class.calendar(@organization.id) |
20 |
| - expected = <<~ICAL |
21 |
| - BEGIN:VCALENDAR |
22 |
| - VERSION:2.0 |
23 |
| - PRODID:icalendar-ruby |
24 |
| - CALSCALE:GREGORIAN |
25 |
| - METHOD:PUBLISH |
26 |
| - BEGIN:VTIMEZONE |
27 |
| - TZID:America/New_York |
28 |
| - BEGIN:DAYLIGHT |
29 |
| - DTSTART:20220313T030000 |
30 |
| - TZOFFSETFROM:-0500 |
31 |
| - TZOFFSETTO:-0400 |
32 |
| - RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3 |
33 |
| - TZNAME:EDT |
34 |
| - END:DAYLIGHT |
35 |
| - BEGIN:STANDARD |
36 |
| - DTSTART:20221106T010000 |
37 |
| - TZOFFSETFROM:-0400 |
38 |
| - TZOFFSETTO:-0500 |
39 |
| - RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11 |
40 |
| - TZNAME:EST |
41 |
| - END:STANDARD |
42 |
| - END:VTIMEZONE |
43 |
| - BEGIN:VEVENT |
44 |
| - DTSTART;TZID=America/New_York:20220317T070000 |
45 |
| - DTEND;TZID=America/New_York:20220317T071500 |
46 |
| - LOCATION:1500 Remount Road\\, Front Royal\\, VA 22630 |
47 |
| - SUMMARY:Pickup from Partner 1 |
48 |
| - URL:https://humanessentials.app/diaper_bank/distributions/schedule |
49 |
| - END:VEVENT |
50 |
| - BEGIN:VEVENT |
51 |
| - DTSTART;TZID=America/New_York:20220217T060000 |
52 |
| - DTEND;TZID=America/New_York:20220217T061500 |
53 |
| - LOCATION:1500 Remount Road\\, Front Royal\\, VA 22630 |
54 |
| - SUMMARY:Pickup from Partner 1 |
55 |
| - URL:https://humanessentials.app/diaper_bank/distributions/schedule |
56 |
| - END:VEVENT |
57 |
| - BEGIN:VEVENT |
58 |
| - DTSTART;TZID=America/New_York:20230316T210000 |
59 |
| - DTEND;TZID=America/New_York:20230316T211500 |
60 |
| - LOCATION:1500 Remount Road\\, Front Royal\\, VA 22630 |
61 |
| - SUMMARY:Pickup from Partner 2 |
62 |
| - URL:https://humanessentials.app/diaper_bank/distributions/schedule |
63 |
| - END:VEVENT |
64 |
| - END:VCALENDAR |
65 |
| - ICAL |
66 |
| - # remove nondeterministic values and replace \n with \r\n |
67 |
| - result = result.gsub(/\r\nDTSTAMP:.*\r\n/, "\r\n").gsub(/\r\nUID:.*\r\n/, "\r\n") |
68 |
| - expect(result).to eq(expected.gsub("\n", "\r\n")) |
69 | 69 | end
|
70 | 70 | end
|
71 | 71 |
|
|
0 commit comments