|
20 | 20 | site_admin_logged_in |
21 | 21 | end |
22 | 22 |
|
23 | | - context "with all notifications loaded" do |
24 | | - before :once do |
25 | | - NotificationsCommon.load_all_notifications |
26 | | - end |
27 | | - |
28 | | - context "with appointment group created" do |
29 | | - before(:each) do |
30 | | - create_appointment_group |
31 | | - @appt_grp = AppointmentGroup.last |
32 | | - end |
33 | | - |
34 | | - it "should send a notification that appointment group is available", priority: "1", test_id: 186566 do |
35 | | - expected_notification = 'Appointment Group Published' |
36 | | - |
37 | | - expect(Message.last.notification_name).to eql(expected_notification) |
38 | | - expect(Message.last.subject).to include_text("Appointment \"#{@appt_grp.title}\" is available for signup") |
39 | | - expect(Message.last.to).to eql(@student.email) |
40 | | - end |
41 | | - |
42 | | - it "should send a notification when appointment group is updated", priority: "1", test_id: 193138 do |
43 | | - expected_notification = 'Appointment Group Updated' |
44 | | - @appt_grp.update_attributes(new_appointments: [[Time.zone.today + 2.days, Time.zone.today + 3.days]]) |
45 | | - |
46 | | - expect(Message.last.notification_name).to eql(expected_notification) |
47 | | - expect(Message.last.subject).to include_text("Appointment \"#{@appt_grp.title}\" has been updated") |
48 | | - expect(Message.last.to).to eql(@student.email) |
49 | | - end |
50 | | - |
51 | | - it "should send a notification when appointment group is deleted", priority: "1", test_id: 193137 do |
52 | | - expected_notification = 'Appointment Group Deleted' |
53 | | - @appt_grp.destroy |
54 | | - |
55 | | - expect(Message.last.notification_name).to eql(expected_notification) |
56 | | - expect(Message.last.subject).to include_text("Appointments for #{@appt_grp.title} have been canceled") |
57 | | - expect(Message.last.to).to eql(@student.email) |
58 | | - end |
59 | | - |
60 | | - it "should notify teacher when appointment is reserved by user", priority: "1", test_id: 193144 do |
61 | | - skip "This spec is blocked by CNVS-24671" |
62 | | - |
63 | | - # TODO: Verify this is the correct Notification name |
64 | | - expected_notification = 'Appointment Reserved By User' |
65 | | - appt_grp_evt = @appt_grp.appointments[0] |
66 | | - appt_grp_evt.reserve_for(@student, @student) |
67 | | - |
68 | | - expect(Message.last.notification_name).to eql(expected_notification) |
69 | | - |
70 | | - # TODO: Update the text for the notification |
71 | | - expect(Message.last.subject).to include_text("Appointments for #{@appt_grp.title} have been canceled") |
72 | | - expect(Message.last.to).to eql(@teacher.email) |
73 | | - end |
74 | | - |
75 | | - it "should notify student when appointment scheduled on their behalf", priority: "1", test_id: 193149 do |
76 | | - expected_notification = 'Appointment Reserved For User' |
77 | | - appt_grp_evt = @appt_grp.appointments[0] |
78 | | - appt_grp_evt.reserve_for(@student, @teacher) |
79 | | - |
80 | | - expect(Message.last.notification_name).to eql(expected_notification) |
81 | | - expect(Message.last.subject).to include_text("You have been signed up for \"#{@appt_grp.title}\"") |
82 | | - expect(Message.last.to).to eql(@student.email) |
83 | | - end |
84 | | - |
85 | | - it "should notify teacher when student deletes appointment", priority: "1", test_id: 193147 do |
86 | | - skip "This spec is blocked by CNVS-24671" |
87 | | - |
88 | | - # TODO: Verify this is the correct Notification name |
89 | | - expected_notification = 'Appointment Deleted By User' |
90 | | - appt_grp_evt = @appt_grp.appointments[0] |
91 | | - appt_grp_evt.reserve_for(@student, @student) |
92 | | - appt_grp_evt.updating_user = @student |
93 | | - appt_grp_evt.destroy |
94 | | - |
95 | | - expect(Message.last.notification_name).to eql(expected_notification) |
96 | | - |
97 | | - # TODO: Update the text for the notification |
98 | | - expect(Message.last.subject).to include_text("Your time slot for #{@appt_grp.title} has been canceled") |
99 | | - expect(Message.last.to).to eql(@student.email) |
100 | | - end |
101 | | - |
102 | | - it "should notify student when appointment is deleted", priority: "1", test_id: 193148 do |
103 | | - expected_notification = 'Appointment Deleted For User' |
104 | | - appt_grp_evt = @appt_grp.appointments[0] |
105 | | - appt_grp_evt.reserve_for(@student, @student) |
106 | | - appt_grp_evt.updating_user = @teacher |
107 | | - appt_grp_evt.destroy |
108 | | - |
109 | | - expect(Message.last.notification_name).to eql(expected_notification) |
110 | | - expect(Message.last.subject).to include_text("Your time slot for #{@appt_grp.title} has been canceled") |
111 | | - expect(Message.last.to).to eql(@student.email) |
112 | | - end |
113 | | - |
114 | | - it "should notify student when appointment is un-reserved", priority: "1", test_id: 502005 do |
115 | | - expected_notification = 'Appointment Deleted For User' |
116 | | - appt_grp_evt = @appt_grp.appointments[0] |
117 | | - appt_grp_evt.reserve_for(@student, @student) |
118 | | - user_evt = CalendarEvent.where(context_type: 'User').first |
119 | | - user_evt.updating_user = @teacher |
120 | | - user_evt.destroy |
121 | | - |
122 | | - expect(Message.last.notification_name).to eql(expected_notification) |
123 | | - expect(Message.last.subject).to include_text("Your time slot for #{@appt_grp.title} has been canceled") |
124 | | - expect(Message.last.to).to eql(@student.email) |
125 | | - end |
126 | | - end |
127 | | - end |
128 | | - |
129 | 23 | context "Assignment notifications" do |
130 | 24 | before :each do |
131 | 25 | setup_notification(@teacher, name: 'Assignment Submitted', sms: true) |
|
0 commit comments