|
66 | 66 |
|
67 | 67 | manager.send_event_emails(event, chapter)
|
68 | 68 | end
|
| 69 | + |
| 70 | + it 'emails only students that accepted toc' do |
| 71 | + event = Fabricate(:event, chapters: [chapter], audience: 'Students') |
| 72 | + |
| 73 | + first_student, *other_students = students |
| 74 | + first_student.update(accepted_toc_at: nil) |
| 75 | + |
| 76 | + expect(Invitation).to_not( |
| 77 | + receive(:new). |
| 78 | + with(event: event, member: first_student, role: 'Student'). |
| 79 | + and_call_original |
| 80 | + ) |
| 81 | + |
| 82 | + other_students.each do |other_student| |
| 83 | + expect(Invitation).to( |
| 84 | + receive(:new). |
| 85 | + with(event: event, member: other_student, role: 'Student'). |
| 86 | + and_call_original |
| 87 | + ) |
| 88 | + end |
| 89 | + |
| 90 | + manager.send_event_emails(event, chapter) |
| 91 | + end |
| 92 | + |
| 93 | + it 'emails only coaches that accepted toc' do |
| 94 | + event = Fabricate(:event, chapters: [chapter], audience: 'Coaches') |
| 95 | + |
| 96 | + first_coach, *other_coaches = coaches |
| 97 | + first_coach.update(accepted_toc_at: nil) |
| 98 | + |
| 99 | + expect(Invitation).to_not( |
| 100 | + receive(:new). |
| 101 | + with(event: event, member: first_coach, role: 'Coach'). |
| 102 | + and_call_original |
| 103 | + ) |
| 104 | + |
| 105 | + other_coaches.each do |other_coach| |
| 106 | + expect(Invitation).to( |
| 107 | + receive(:new). |
| 108 | + with(event: event, member: other_coach, role: 'Coach'). |
| 109 | + and_call_original |
| 110 | + ) |
| 111 | + end |
| 112 | + |
| 113 | + manager.send_event_emails(event, chapter) |
| 114 | + end |
69 | 115 | end
|
70 | 116 |
|
71 | 117 | describe '#send_monthly_attendance_reminder_emails', wip: true do
|
|
0 commit comments