Skip to content

Commit 9295df6

Browse files
beckeseaDerek Hansen
authored andcommitted
Spec: remove duplicate appointment group notification specs
Remove duplicated specs, add test rail ids, and fix one spec that was testing the wrong action. Test plan: Run specs, review organization Change-Id: I4e8e4c989e92d1b0ccf6a0abd7383742787b3834 Reviewed-on: https://gerrit.instructure.com/67819 Tested-by: Jenkins Reviewed-by: Derek Hansen <dhansen@instructure.com> Product-Review: Derek Hansen <dhansen@instructure.com> QA-Review: Derek Hansen <dhansen@instructure.com>
1 parent 79733a6 commit 9295df6

3 files changed

Lines changed: 11 additions & 116 deletions

File tree

spec/models/appointment_group_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,20 +345,20 @@
345345
@ag = AppointmentGroup.create!(:title => "test", :contexts => [@course], :new_appointments => [['2012-01-01 13:00:00', '2012-01-01 14:00:00']])
346346
end
347347

348-
it "should notify all participants when publishing" do
348+
it "should notify all participants when publishing", priority: "1", test_id: 186566 do
349349
@ag.publish!
350350
expect(@ag.messages_sent).to be_include("Appointment Group Published")
351351
expect(@ag.messages_sent["Appointment Group Published"].map(&:user_id).sort.uniq).to eql [@student.id]
352352
end
353353

354-
it "should notify all participants when adding appointments" do
354+
it "should notify all participants when adding appointments", priority: "1", test_id: 193138 do
355355
@ag.publish!
356356
@ag.update_attributes(:new_appointments => [['2012-01-01 12:00:00', '2012-01-01 13:00:00']])
357357
expect(@ag.messages_sent).to be_include("Appointment Group Updated")
358358
expect(@ag.messages_sent["Appointment Group Updated"].map(&:user_id).sort.uniq).to eql [@student.id]
359359
end
360360

361-
it "should notify all participants when deleting" do
361+
it "should notify all participants when deleting", priority: "1", test_id: 193137 do
362362
@ag.publish!
363363
@ag.cancel_reason = "just because"
364364
@ag.destroy

spec/models/calendar_event_spec.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@
420420
end
421421
end
422422

423-
it "should notify all participants except the person reserving" do
423+
it "should notify all participants except the person reserving", priority: "1", test_id: 193149 do
424424
reservation = @appointment2.reserve_for(@group, @student1)
425425
expect(Message.where(notification_id: BroadcastPolicy.notification_finder.by_name("Appointment Reserved For User"), user_id: [@student1, @student2]).pluck(:user_id)).to eq [@student2.id]
426426
end
@@ -432,28 +432,29 @@
432432
expect(Message.where(notification_id: BroadcastPolicy.notification_finder.by_name("Appointment Deleted For User"), user_id: [@student1, @student2]).pluck(:user_id)).to eq [@student2.id]
433433
end
434434

435-
it "should notify participants if teacher deletes the appointment time slot" do
435+
it "should notify participants if teacher deletes the appointment time slot", priority: "1", test_id: 193148 do
436436
reservation = @appointment2.reserve_for(@group, @student1)
437437
@appointment2.updating_user = @teacher
438438
@appointment2.destroy
439439
expect(Message.where(notification_id: BroadcastPolicy.notification_finder.by_name("Appointment Deleted For User"), user_id: [@student1, @student2]).pluck(:user_id).sort).to eq [@student1.id, @student2.id]
440440
end
441441

442-
it "should notify all participants when the the time slot is canceled" do
442+
it "should notify all participants when the the time slot is canceled", priority: "1", test_id: 502005 do
443443
reservation = @appointment2.reserve_for(@group, @student1)
444444
@appointment2.updating_user = @teacher
445-
@appointment2.destroy
446-
expect(@appointment2.messages_sent).to be_empty
445+
user_evt = CalendarEvent.where(context_type: 'Group').first
446+
user_evt.updating_user = @teacher
447+
user_evt.destroy
447448
expect(Message.where(notification_id: BroadcastPolicy.notification_finder.by_name("Appointment Deleted For User"), user_id: [@student1, @student2]).pluck(:user_id).sort).to eq [@student1.id, @student2.id]
448449
end
449450

450-
it "should notify admins when a user reserves" do
451+
it "should notify admins when a user reserves", priority: "1", test_id: 193144 do
451452
reservation = @appointment.reserve_for(@user, @user)
452453
expect(reservation.messages_sent).to be_include("Appointment Reserved By User")
453454
expect(reservation.messages_sent["Appointment Reserved By User"].map(&:user_id).sort.uniq).to eql @course.instructors.map(&:id).sort
454455
end
455456

456-
it "should notify admins when a user cancels" do
457+
it "should notify admins when a user cancels", priority: "1", test_id: 193147 do
457458
reservation = @appointment.reserve_for(@student1, @student1)
458459
reservation.updating_user = @student1
459460
reservation.destroy

spec/selenium/notifications_spec.rb

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -20,112 +20,6 @@
2020
site_admin_logged_in
2121
end
2222

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-
12923
context "Assignment notifications" do
13024
before :each do
13125
setup_notification(@teacher, name: 'Assignment Submitted', sms: true)

0 commit comments

Comments
 (0)