spec: cleanup message specs

-- speed diff --
34.14 sec faster

master: 79.57 sec (205 examples)
this change: 45.43 sec (320 examples)

115 specs were added to test the missing medium variants
(sms, push, etc.)

Change-Id: Iafce703d0fcf124532162563158bef4cc795c50a
Reviewed-on: https://gerrit.instructure.com/99645
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins
This commit is contained in:
Landon Wilkins 2017-01-06 11:16:04 -07:00
parent 79da7c18bf
commit 514cd514f3
196 changed files with 1539 additions and 4450 deletions

View File

@ -21,14 +21,15 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
describe Messages::PeerReviewsHelper do
describe 'assessment requests' do
before :once do
assessment_request_model
end
it 'should should return reviewee name' do
assessment_request_model
expect(reviewee_name(@assessment_request, @user)).to eq(@assessment_request.asset.user.name)
end
it 'should return anonymous when anonymous peer reviews enabled' do
assessment_request_model
assignment = @assessment_request.asset.assignment
assignment.update_attribute(:anonymous_peer_reviews, true)
@assessment_request.reload

View File

@ -19,9 +19,13 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'account_user_notification.email' do
it "should render" do
describe 'account_user_notification' do
before :once do
@object = AccountUser.create(:account => account_model)
msg = generate_message(:account_user_notification, :email, @object)
end
let(:asset) { @object }
let(:notification_name) { :account_user_notification }
include_examples "a message"
end

View File

@ -19,9 +19,13 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'account_user_registration.email' do
it "should render" do
describe 'account_user_registration' do
before :once do
@object = AccountUser.create(:account => account_model, :user => user_with_pseudonym)
generate_message(:account_user_registration, :email, @object)
end
let(:asset) { @object }
let(:notification_name) { :account_user_registration }
include_examples "a message"
end

View File

@ -1,33 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'added_to_conversation.email' do
it "should render" do
course_with_teacher
student1 = student_in_course.user
student2 = student_in_course.user
student3 = student_in_course.user
conversation = @teacher.initiate_conversation([student1, student2])
conversation.add_message("some message")
event = conversation.add_participants([student3])
generate_message(:added_to_conversation, :email, event)
end
end

View File

@ -19,15 +19,46 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'added_to_conversation.summary' do
it "should render" do
describe 'added_to_conversation' do
before :once do
course_with_teacher
student1 = student_in_course.user
student2 = student_in_course.user
student3 = student_in_course.user
conversation = @teacher.initiate_conversation([student1, student2])
conversation.add_message("some message")
event = conversation.add_participants([student3])
generate_message(:added_to_conversation, :summary, event)
@event = conversation.add_participants([student3])
end
end
let(:notification_name) { :added_to_conversation }
let(:asset) { @event }
context ".email" do
let(:path_type) { :email }
it "should render" do
generate_message(notification_name, path_type, asset)
end
end
context ".sms" do
let(:path_type) { :sms }
it "should render" do
generate_message(notification_name, path_type, asset)
end
end
context ".summary" do
let(:path_type) { :summary }
it "should render" do
generate_message(notification_name, path_type, asset)
end
end
context ".twitter" do
let(:path_type) { :twitter }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.body).to be_present
end
end
end

View File

@ -1,33 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'added_to_conversation.sms' do
it "should render" do
course_with_teacher
student1 = student_in_course.user
student2 = student_in_course.user
student3 = student_in_course.user
conversation = @teacher.initiate_conversation([student1, student2])
conversation.add_message("some message")
event = conversation.add_participants([student3])
generate_message(:added_to_conversation, :sms, event)
end
end

View File

@ -1,35 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'added_to_conversation.twitter' do
it "should render" do
course_with_teacher
student1 = student_in_course.user
student2 = student_in_course.user
student3 = student_in_course.user
conversation = @teacher.initiate_conversation([student1, student2])
conversation.add_message("some message")
event = conversation.add_participants([student3])
generate_message(:added_to_conversation, :twitter, event)
expect(@message.main_link).to be_present
expect(@message.body).to be_present
end
end

View File

@ -20,30 +20,23 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'alert' do
before do
before :once do
course_with_student
@alert = @course.alerts.create!(:recipients => [:student], :criteria => [:criterion_type => 'Interaction', :threshold => 7])
@alert = @course.alerts.create!(recipients: [:student],
criteria: [
criterion_type: 'Interaction',
threshold: 7
])
@enrollment = @course.enrollments.first
end
it "should render email" do
generate_message(:alert, :email, @alert, :asset_context => @course.enrollments.first)
let(:asset) { @alert }
let(:notification_name) { :alert }
let(:message_data) do
{
asset_context: @enrollment
}
end
it "should render sms" do
generate_message(:alert, :sms, @alert, :asset_context => @course.enrollments.first)
end
it "should render summary" do
generate_message(:alert, :summary, @alert, :asset_context => @course.enrollments.first)
end
it "should render twitter" do
generate_message(:alert, :twitter, @alert, :asset_context => @course.enrollments.first)
expect(@message.main_link).to be_present
expect(@message.body).to be_present
end
it "should render push" do
generate_message(:alert, :push, @alert, asset_context: @course.enrollments.first)
end
include_examples "a message"
end

View File

@ -1,31 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'announcement_created_by_you.email' do
it "should render" do
announcement_model
@object = @a
@message = generate_message(:announcement_created_by_you, :email, @object)
expect(@message.subject).to eq "value for title: value for name"
expect(@message.url).to match(/\/courses\/\d+\/announcements\/\d+/)
expect(@message.body).to match(/\/courses\/\d+\/announcements\/\d+/)
end
end

View File

@ -0,0 +1,66 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'announcement_created_by_you' do
before :once do
@announcement = announcement_model
end
let(:notification_name) { :announcement_created_by_you }
let(:asset) { @announcement }
context ".email" do
let(:path_type) { :email }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.subject).to eq "value for title: value for name"
expect(msg.url).to match(/\/courses\/\d+\/announcements\/\d+/)
expect(msg.body).to match(/\/courses\/\d+\/announcements\/\d+/)
end
end
context ".sms" do
let(:path_type) { :sms }
it "should render" do
generate_message(notification_name, path_type, asset)
end
end
context ".summary" do
let(:path_type) { :summary }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.subject).to eq "value for title: value for name"
expect(msg.url).to match(/\/courses\/\d+\/announcements\/\d+/)
expect(msg.body.strip).to eq "value for message"
end
end
context ".twitter" do
let(:path_type) { :twitter }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.subject).to eq "Canvas Alert"
expect(msg.url).to match(/\/courses\/\d+\/announcements\/\d+/)
expect(msg.body).to include("Canvas Alert - You created this Announcement: value for title")
end
end
end

View File

@ -1,31 +0,0 @@
#
# Copyright (C) 2013 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'announcement_created_by_you.summary' do
it "should render" do
announcement_model
@object = @a
@message = generate_message(:announcement_created_by_you, :summary, @object)
expect(@message.subject).to eq "value for title: value for name"
expect(@message.url).to match(/\/courses\/\d+\/announcements\/\d+/)
expect(@message.body.strip).to eq "value for message"
end
end

View File

@ -1,31 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'announcement_created_by_you.twitter' do
it "should render" do
announcement_model
@object = @a
@message = generate_message(:announcement_created_by_you, :twitter, @object)
expect(@message.subject).to eq "Canvas Alert"
expect(@message.url).to match(/\/courses\/\d+\/announcements\/\d+/)
expect(@message.body).to include("Canvas Alert - You created this Announcement: value for title")
end
end

View File

@ -1,31 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'announcement_reply.email' do
it "should render" do
announcement_model
@object = @a
@message = generate_message(:new_announcement, :email, @object)
expect(@message.subject).to eq "value for title: value for name"
expect(@message.url).to match(/\/courses\/\d+\/announcements\/\d+/)
expect(@message.body).to match(/\/courses\/\d+\/announcements\/\d+/)
end
end

View File

@ -0,0 +1,68 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'announcement_reply' do
before :once do
course_with_teacher(active_all: true)
@announcement = announcement_model(user: @teacher, discussion_type: 'threaded')
@announcement.reply_from(user: @teacher, text: 'hai')
end
let(:notification_name) { :announcement_reply }
let(:asset) { @announcement }
context ".email" do
let(:path_type) { :email }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.subject).to eq "New Comment on Announcement value for title: value for name"
expect(msg.url).to match(/\/courses\/\d+\/discussion_topics\/\d+/)
expect(msg.body).to match(/\/courses\/\d+\/discussion_topics\/\d+/)
end
end
context ".sms" do
let(:path_type) { :sms }
it "should render" do
generate_message(notification_name, path_type, asset)
end
end
context ".summary" do
let(:path_type) { :summary }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.subject).to eq "New Comment on Announcement: value for title: value for name"
expect(msg.url).to match(/\/courses\/\d+\/discussion_topics\/\d+/)
expect(msg.body.strip).to eq "value for message"
end
end
context ".twitter" do
let(:path_type) { :twitter }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.subject).to eq "Canvas Alert"
expect(msg.url).to match(/\/courses\/\d+\/discussion_topics\/\d+/)
expect(msg.body).to include("Canvas Alert - Announcement Comment: value for title, value for name")
end
end
end

View File

@ -1,31 +0,0 @@
#
# Copyright (C) 2013 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'announcement_reply.summary' do
it "should render" do
announcement_model
@object = @a
@message = generate_message(:new_announcement, :summary, @object)
expect(@message.subject).to eq "value for title: value for name"
expect(@message.url).to match(/\/courses\/\d+\/announcements\/\d+/)
expect(@message.body.strip).to eq "value for message"
end
end

View File

@ -1,31 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'announcement_reply.twitter' do
it "should render" do
announcement_model
@object = @a
@message = generate_message(:new_announcement, :twitter, @object)
expect(@message.subject).to eq "Canvas Alert"
expect(@message.url).to match(/\/courses\/\d+\/announcements\/\d+/)
expect(@message.body).to include("Canvas Alert - Announcement: value for title")
end
end

View File

@ -30,7 +30,6 @@ describe 'appointment_canceled_by_user.twitter' do
expect(@message.body).to include('some title')
expect(@message.body).to include(user.name)
expect(@message.main_link).to be_present
end
it "should render for groups" do
@ -47,6 +46,5 @@ describe 'appointment_canceled_by_user.twitter' do
expect(@message.body).to include('some title')
expect(@message.body).to include(user.name)
expect(@message.main_link).to be_present
end
end

View File

@ -30,7 +30,6 @@ describe 'appointment_deleted_for_user.twitter' do
:cancel_reason => "just because"})
expect(@message.body).to include('some title')
expect(@message.main_link).to be_present
end
it "should render for groups" do
@ -47,6 +46,5 @@ describe 'appointment_deleted_for_user.twitter' do
:cancel_reason => "just because"})
expect(@message.body).to include('some title')
expect(@message.main_link).to be_present
end
end

View File

@ -1,35 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_group_deleted.email' do
it "should render" do
course_with_student(:active_all => true)
appointment_group_model(:contexts => [@course])
generate_message(:appointment_group_deleted, :email, @appointment_group,
:user => @user, :data => {:cancel_reason => "because"})
expect(@message.subject).to include('some title')
expect(@message.body).to include('some title')
expect(@message.body).to include('because')
expect(@message.body).to include(@course.name)
end
end

View File

@ -0,0 +1,78 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_group_deleted' do
before :once do
course_with_student(:active_all => true)
@cat = @course.group_categories.create(:name => 'teh category')
appointment_group_model(:contexts => [@course], :sub_context => @cat)
end
let(:notification_name) { :appointment_group_updated }
let(:asset) { @appointment_group }
let(:message_data) do
{
user: @user,
cancel_reason: "just because"
}
end
context ".email" do
let(:path_type) { :email }
it "should render" do
msg = generate_message(notification_name, path_type, asset, message_data)
expect(msg.subject).to include('some title')
expect(msg.body).to include('some title')
expect(msg.body).to include(@course.name)
expect(msg.body).to include("/appointment_groups/#{@appointment_group.id}")
end
it "should render for groups" do
msg = generate_message(notification_name, path_type, asset, message_data)
expect(msg.body).to include(@cat.name)
end
end
context ".sms" do
let(:path_type) { :sms }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.body).to include('some title')
end
end
context ".summary" do
let(:path_type) { :summary }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.subject).to include('some title')
expect(msg.body).to include('some title')
end
end
context ".twitter" do
let(:path_type) { :twitter }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.body).to include('some title')
end
end
end

View File

@ -1,31 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_group_deleted.sms' do
it "should render" do
appointment_group_model(:contexts => [course_model])
generate_message(:appointment_group_deleted, :sms, @appointment_group,
:data => {:cancel_reason => "just because"})
expect(@message.body).to include('some title')
end
end

View File

@ -1,31 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_group_deleted.twitter' do
it "should render" do
appointment_group_model(:contexts => [course_model])
generate_message(:appointment_group_deleted, :twitter, @appointment_group,
:data => {:cancel_reason => "just because"})
expect(@message.body).to include('some title')
end
end

View File

@ -1,49 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_group_published.email' do
it "should render" do
course_with_student(:active_all => true)
appointment_group_model(:contexts => [@course])
generate_message(:appointment_group_published, :email, @appointment_group, :user => @user)
expect(@message.subject).to include('some title')
expect(@message.body).to include('some title')
expect(@message.body).to include(@course.name)
expect(@message.body).to include("/appointment_groups/#{@appointment_group.id}")
end
it "should render for groups" do
user = user_model
@course = course_model
cat = @course.group_categories.create(:name => 'teh category')
appointment_group_model(:contexts => [@course], :sub_context => cat)
generate_message(:appointment_group_published, :email, @appointment_group)
expect(@message.subject).to include('some title')
expect(@message.body).to include('some title')
expect(@message.body).to include(@course.name)
expect(@message.body).to include(cat.name)
expect(@message.body).to include("/appointment_groups/#{@appointment_group.id}")
end
end

View File

@ -0,0 +1,73 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_group_published' do
before :once do
course_with_student(:active_all => true)
@cat = @course.group_categories.create(:name => 'teh category')
appointment_group_model(:contexts => [@course], :sub_context => @cat)
end
let(:notification_name) { :appointment_group_published }
let(:asset) { @appointment_group }
let(:message_data) { { user: @user } }
context ".email" do
let(:path_type) { :email }
it "should render" do
msg = generate_message(notification_name, path_type, asset, message_data)
expect(msg.subject).to include('some title')
expect(msg.body).to include('some title')
expect(msg.body).to include(@course.name)
expect(msg.body).to include("/appointment_groups/#{@appointment_group.id}")
end
it "should render for groups" do
msg = generate_message(notification_name, path_type, asset, message_data)
expect(msg.body).to include(@cat.name)
end
end
context ".sms" do
let(:path_type) { :sms }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.body).to include('some title')
end
end
context ".summary" do
let(:path_type) { :summary }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.subject).to include('some title')
expect(msg.body).to include('some title')
end
end
context ".twitter" do
let(:path_type) { :twitter }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.body).to include('some title')
end
end
end

View File

@ -1,32 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_group_published.summary' do
it "should render" do
user = user_model
appointment_group_model(:contexts => [course_model])
generate_message(:appointment_group_published, :summary, @appointment_group)
expect(@message.subject).to include('some title')
expect(@message.body).to include('some title')
end
end

View File

@ -1,31 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_group_published.twitter' do
it "should render" do
user = user_model
appointment_group_model(:contexts => [course_model])
generate_message(:appointment_group_published, :twitter, @appointment_group)
expect(@message.body).to include('some title')
end
end

View File

@ -1,49 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_group_updated.email' do
it "should render" do
user = course_with_student(:active_all => true)
appointment_group_model(:contexts => [@course])
generate_message(:appointment_group_updated, :email, @appointment_group, :user => @user)
expect(@message.subject).to include('some title')
expect(@message.body).to include('some title')
expect(@message.body).to include(@course.name)
expect(@message.body).to include("/appointment_groups/#{@appointment_group.id}")
end
it "should render for groups" do
user = user_model
@course = course_model
cat = @course.group_categories.create(:name => 'teh category')
appointment_group_model(:contexts => [@course], :sub_context => cat)
generate_message(:appointment_group_updated, :email, @appointment_group)
expect(@message.subject).to include('some title')
expect(@message.body).to include('some title')
expect(@message.body).to include(@course.name)
expect(@message.body).to include(cat.name)
expect(@message.body).to include("/appointment_groups/#{@appointment_group.id}")
end
end

View File

@ -0,0 +1,73 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_group_updated' do
before :once do
course_with_student(:active_all => true)
@cat = @course.group_categories.create(:name => 'teh category')
appointment_group_model(:contexts => [@course], :sub_context => @cat)
end
let(:notification_name) { :appointment_group_updated }
let(:asset) { @appointment_group }
let(:message_data) { { user: @user } }
context ".email" do
let(:path_type) { :email }
it "should render" do
msg = generate_message(notification_name, path_type, asset, message_data)
expect(msg.subject).to include('some title')
expect(msg.body).to include('some title')
expect(msg.body).to include(@course.name)
expect(msg.body).to include("/appointment_groups/#{@appointment_group.id}")
end
it "should render for groups" do
msg = generate_message(notification_name, path_type, asset, message_data)
expect(msg.body).to include(@cat.name)
end
end
context ".sms" do
let(:path_type) { :sms }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.body).to include('some title')
end
end
context ".summary" do
let(:path_type) { :summary }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.subject).to include('some title')
expect(msg.body).to include('some title')
end
end
context ".twitter" do
let(:path_type) { :twitter }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.body).to include('some title')
end
end
end

View File

@ -1,31 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_group_updated.sms' do
it "should render" do
user = user_model
appointment_group_model(:contexts => [course_model])
generate_message(:appointment_group_updated, :sms, @appointment_group)
expect(@message.body).to include('some title')
end
end

View File

@ -1,32 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_group_updated.email' do
it "should render" do
user = user_model
appointment_group_model(:contexts => [course_model])
generate_message(:appointment_group_updated, :summary, @appointment_group)
expect(@message.subject).to include('some title')
expect(@message.body).to include('some title')
end
end

View File

@ -1,31 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_group_updated.twitter' do
it "should render" do
user = user_model
appointment_group_model(:contexts => [course_model])
generate_message(:appointment_group_updated, :twitter, @appointment_group)
expect(@message.body).to include('some title')
end
end

View File

@ -1,57 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_reserved_by_user.email' do
it "should render" do
user = user_model
course_with_student(course: @course, active_enrollment: true)
appointment_participant_model(:participant => user, :updating_user => @user)
generate_message(:appointment_reserved_by_user, :email, @event,
:user => @user, :data => {:updating_user => user})
expect(@message.subject).to include('some title')
expect(@message.body).to include('some title')
expect(@message.body).to include(user.name)
expect(@message.body).to include(@course.name)
expect(@message.body).to include("/appointment_groups/#{@appointment_group.id}")
end
it "should render for groups" do
user = user_model
@course = course_model
cat = group_category
user_model
@group = cat.groups.create(:context => @course)
@group.users << user << @user
appointment_participant_model(:participant => @group, :course => @course, :updating_user => @user)
generate_message(:appointment_reserved_by_user, :email, @event,
:user => @user, :data => {:updating_user => user})
expect(@message.subject).to include('some title')
expect(@message.body).to include('some title')
expect(@message.body).to include(user.name)
expect(@message.body).to include(@group.name)
expect(@message.body).to include(@course.name)
expect(@message.body).to include("/appointment_groups/#{@appointment_group.id}")
end
end

View File

@ -0,0 +1,84 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_reserved_by_user.twitter' do
before :once do
@user = user_model
appointment_participant_model(participant: @user)
end
let(:asset) { @event }
let(:notification_name) { :appointment_reserved_by_user }
let(:message_data) {
{
data: { updating_user: @user },
user: @user
}
}
context ".email" do
let(:path_type) { :email }
before :once do
@user = user_model
@course = course_model
@cat = group_category
user_model
@group = @cat.groups.create(:context => @course)
@group.users << @user
appointment_participant_model(participant: @group,
course: @course,
updating_user: @user)
end
it "should render" do
msg = generate_message(notification_name, path_type, asset, message_data)
expect(msg.subject).to include('some title')
expect(msg.body).to include('some title')
expect(msg.body).to include(@user.name)
expect(msg.body).to include(@course.name)
expect(msg.body).to include("/appointment_groups/#{@appointment_group.id}")
end
it "should render for groups" do
msg = generate_message(notification_name, path_type, asset, message_data)
expect(msg.body).to include(@group.name)
end
end
context ".sms" do
let(:path_type) { :sms }
it "should render" do
msg = generate_message(notification_name, path_type, asset, message_data)
expect(msg.body).to include('some title')
expect(msg.body).to include(@user.name)
end
end
context ".twitter" do
let(:path_type) { :twitter }
it "should render" do
msg = generate_message(notification_name, path_type, asset, message_data)
expect(msg.body).to include('some title')
expect(msg.body).to include(@user.name)
end
end
end

View File

@ -1,33 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_reserved_by_user.sms' do
it "should render" do
user = user_model
appointment_participant_model(:participant => user)
generate_message(:appointment_reserved_by_user, :sms, @event,
:data => {:updating_user => user})
expect(@message.body).to include('some title')
expect(@message.body).to include(user.name)
end
end

View File

@ -1,33 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_reserved_by_user.twitter' do
it "should render" do
user = user_model
appointment_participant_model(:participant => user)
generate_message(:appointment_reserved_by_user, :twitter, @event,
:data => {:updating_user => user})
expect(@message.body).to include('some title')
expect(@message.body).to include(user.name)
end
end

View File

@ -1,57 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_reserved_for_user.email' do
it "should render" do
user = user_model
appointment_participant_model(:participant => user)
generate_message(:appointment_reserved_for_user, :email, @event,
:data => {:updating_user => @teacher})
expect(@message.subject).to include('some title')
expect(@message.body).to include('some title')
expect(@message.body).to include(@teacher.name)
expect(@message.body).to include(user.name)
expect(@message.body).to include(@course.name)
expect(@message.body).to include("/appointment_groups/#{@appointment_group.id}")
end
it "should render for groups" do
user = user_model
@course = course_model
cat = group_category
@group = cat.groups.create(:context => @course)
@group.users << user
appointment_participant_model(:participant => @group, :course => @course)
generate_message(:appointment_reserved_for_user, :email, @event,
:data => {:updating_user => @teacher})
expect(@message.subject).to include('some title')
expect(@message.body).to include('some title')
expect(@message.body).to include(@teacher.name)
expect(@message.body).to include(user.name)
expect(@message.body).to include(@group.name)
expect(@message.body).to include(@course.name)
expect(@message.body).to include("/appointment_groups/#{@appointment_group.id}")
end
end

View File

@ -0,0 +1,82 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_reserved_for_user' do
before :once do
@user = user_model
@course = course_model
cat = group_category
@group = cat.groups.create(context: @course)
@group.users << @user
appointment_participant_model(participant: @group, course: @course)
end
let(:notification_name) { :appointment_reserved_for_user }
let(:asset) { @event }
let(:message_options) { { data: { updating_user: @teacher } } }
context ".email" do
let(:path_type) { :email }
it "should render" do
msg = generate_message(notification_name, path_type, asset, message_options)
expect(msg.subject).to include('some title')
expect(msg.body).to include('some title')
expect(msg.body).to include(@teacher.name)
expect(msg.body).to include(@user.name)
expect(msg.body).to include(@course.name)
expect(msg.body).to include("/appointment_groups/#{@appointment_group.id}")
end
context "for groups" do
it "should render group name" do
msg = generate_message(notification_name, path_type, asset, message_options)
expect(msg.body).to include(@group.name)
end
end
end
context ".sms" do
let(:path_type) { :sms }
it "should render" do
msg = generate_message(notification_name, path_type, asset, message_options)
expect(msg.body).to include('some title')
end
end
context ".summary" do
let(:path_type) { :summary }
it "should render" do
msg = generate_message(notification_name, path_type, asset, message_options)
expect(msg.subject).to include('some title')
expect(msg.body).to include('some title')
expect(msg.body).to include(@teacher.name)
end
end
context ".twitter" do
let(:path_type) { :twitter }
it "should render" do
msg = generate_message(notification_name, path_type, asset, message_options)
expect(msg.body).to include('some title')
end
end
end

View File

@ -1,32 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_reserved_for_user.sms' do
it "should render" do
user = user_model
appointment_participant_model(:participant => user)
generate_message(:appointment_reserved_for_user, :sms, @event,
:data => {:updating_user => @teacher})
expect(@message.body).to include('some title')
end
end

View File

@ -1,34 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_reserved_for_user.summary' do
it "should render" do
user = user_model
appointment_participant_model(:participant => user)
generate_message(:appointment_reserved_for_user, :summary, @event,
:data => {:updating_user => @teacher})
expect(@message.subject).to include('some title')
expect(@message.body).to include('some title')
expect(@message.body).to include(@teacher.name)
end
end

View File

@ -1,32 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_reserved_for_user.twitter' do
it "should render" do
user = user_model
appointment_participant_model(:participant => user)
generate_message(:appointment_reserved_for_user, :twitter, @event,
:data => {:updating_user => @teacher})
expect(@message.body).to include('some title')
end
end

View File

@ -1,32 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_changed.email' do
it "should render" do
assignment_model(:title => "Quiz 1")
generate_message(:assignment_changed, :email, @assignment)
expect(@message.subject).to match(/Quiz 1/)
expect(@message.body).to match(/Quiz 1/)
expect(@message.body).to match(Regexp.new(@course.name))
expect(@message.body).to match(/#{HostUrl.protocol}:\/\//)
expect(@message.body).to match(/courses\/#{@assignment.context_id}\/assignments\/#{@assignment.id}/)
end
end

View File

@ -0,0 +1,59 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_changed' do
before :once do
assignment_model(:title => "Quiz 1")
end
let(:notification_name) { :assignment_changed }
let(:asset) { @assignment }
context ".email" do
let(:path_type) { :email }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.subject).to match(/Quiz 1/)
expect(msg.body).to match(/Quiz 1/)
expect(msg.body).to match(Regexp.new(@course.name))
expect(msg.body).to match(/#{HostUrl.protocol}:\/\//)
expect(msg.body).to match(/courses\/#{@assignment.context_id}\/assignments\/#{@assignment.id}/)
end
end
context ".sms" do
let(:path_type) { :sms }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.body).to match(/Quiz 1/)
expect(msg.body).to match(Regexp.new(@course.name))
end
end
context ".summary" do
let(:path_type) { :summary }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.subject).to match(/Quiz 1/)
expect(msg.subject).to match(Regexp.new(@course.name))
end
end
end

View File

@ -1,29 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_changed.sms' do
it "should render" do
assignment_model(:title => "Quiz 1")
generate_message(:assignment_changed, :sms, @assignment)
expect(@message.body).to match(/Quiz 1/)
expect(@message.body).to match(Regexp.new(@course.name))
end
end

View File

@ -1,29 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_changed.summary' do
it "should render" do
assignment_model(:title => "Quiz 1")
generate_message(:assignment_changed, :summary, @assignment)
expect(@message.subject).to match(/Quiz 1/)
expect(@message.subject).to match(Regexp.new(@course.name))
end
end

View File

@ -19,12 +19,35 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_created.email' do
it "should render" do
describe 'assignment_created' do
before :once do
assignment_model(:title => "Quiz 2")
generate_message(:assignment_created, :email, @assignment)
expect(@message.subject).to match(/Quiz 2/)
expect(@message.body).to match(/Quiz 2/)
expect(@message.body).to match(Regexp.new(@course.name))
end
end
let(:notification_name) { :assignment_created }
let(:asset) { @assignment }
context ".email" do
let(:path_type) { :email }
it "should render" do
msg = generate_message(notification_name, path_type, asset)
expect(msg.subject).to match(/Quiz 2/)
expect(msg.body).to match(/Quiz 2/)
expect(msg.body).to match(Regexp.new(@course.name))
end
end
context ".sms" do
let(:path_type) { :sms }
it "should render" do
generate_message(notification_name, path_type, asset)
end
end
context ".summary" do
let(:path_type) { :summary }
it "should render" do
generate_message(notification_name, path_type, asset)
end
end
end

View File

@ -1,28 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_created.summary' do
it "should render" do
assignment_model(:title => "Quiz 1")
@object = @assignment
generate_message(:assignment_created, :summary, @object)
end
end

View File

@ -1,28 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_due_date_changed.email' do
it "should render" do
assignment_model(:title => "Quiz 1")
@object = @assignment
generate_message(:assignment_due_date_changed, :email, @object)
end
end

View File

@ -19,10 +19,13 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_graded.summary' do
it "should render" do
describe 'assignment_due_date_changed' do
before :once do
assignment_model
@object = @assignment
generate_message(:assignment_graded, :summary, @object)
end
end
let(:asset) { @assignment }
let(:notification_name) { :assignment_due_date_changed }
include_examples "a message"
end

View File

@ -1,28 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_due_date_changed.sms' do
it "should render" do
assignment_model(:title => "Quiz 1")
@object = @assignment
generate_message(:assignment_due_date_changed, :sms, @object)
end
end

View File

@ -1,28 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_due_date_changed.summary' do
it "should render" do
assignment_model(:title => "Quiz 1")
@object = @assignment
generate_message(:assignment_due_date_changed, :summary, @object)
end
end

View File

@ -1,28 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_due_date_changed.twitter' do
it "should render" do
assignment_model(:title => "Quiz 1")
@object = @assignment
generate_message(:assignment_due_date_changed, :twitter, @object)
end
end

View File

@ -19,9 +19,13 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_due_date_override_changed.email' do
it "should render" do
describe 'assignment_due_date_override_changed' do
before :once do
assignment_with_override
generate_message(:assignment_due_date_override_changed, :email, @override)
end
end
let(:asset) { @override }
let(:notification_name) { :assignment_due_date_override_changed }
include_examples "a message"
end

View File

@ -1,27 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_due_date_override_changed.sms' do
it "should render" do
assignment_with_override
generate_message(:assignment_due_date_override_changed, :sms, @override)
end
end

View File

@ -1,27 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_due_date_override_changed.summary' do
it "should render" do
assignment_with_override
generate_message(:assignment_due_date_override_changed, :summary, @override)
end
end

View File

@ -1,27 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_due_date_override_changed.twitter' do
it "should render" do
assignment_with_override
generate_message(:assignment_due_date_override_changed, :twitter, @override)
end
end

View File

@ -19,10 +19,13 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_graded.email' do
it "should render" do
describe 'assignment_graded' do
before :once do
assignment_model
@object = @assignment
generate_message(:assignment_graded, :email, @object)
end
let(:asset) { @assignment }
let(:notification_name) { :assignment_graded }
include_examples "a message"
end

View File

@ -1,24 +0,0 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_resubmitted.email' do
it "should render" do
@object = submission_model
generate_message(:assignment_resubmitted, :email, @object)
end
end
# <% define_content :link do %>
# <%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.assignment.context) %>/<%= asset.assignment.context.class.to_s.downcase.pluralize %>/<%= asset.assignment.context_id %>/assignments/<%= asset.assignment_id %>/submissions/<%= asset.user_id %>
# <% end %>
#
# <% define_content :subject do %>
# Re-Submission: <%= asset.user.name %>, <%= asset.assignment.title %>
# <% end %>
#
# <%= asset.user.name %> has just turned in a re-submission for <%= asset.assignment.title %> in the course <%= asset.assignment.context.name %>.
#
# You can view the submission here:
# <%= content :link %>
#

View File

@ -0,0 +1,13 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_resubmitted' do
before :once do
submission_model
end
let(:asset) { @submission }
let(:notification_name) { :assignment_resubmitted }
include_examples "a message"
end

View File

@ -1,14 +0,0 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_resubmitted.sms' do
it "should render" do
@object = submission_model
generate_message(:assignment_resubmitted, :sms, @object)
end
end
# <%= asset.user.name %> just turned in their assignment (again), <%= asset.assignment.title %>
#
# More info at <%= HostUrl.context_host(asset.assignment.context) %>

View File

@ -1,20 +0,0 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_resubmitted.summary' do
it "should render" do
@object = submission_model
generate_message(:assignment_resubmitted, :summary, @object)
end
end
# <% define_content :link do %>
# <%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.assignment.context) %>/<%= asset.assignment.context.class.to_s.downcase.pluralize %>/<%= asset.assignment.context_id %>/assignments/<%= asset.assignment_id %>/submissions/<%= asset.user_id %>
# <% end %>
#
# <% define_content :subject do %>
# Re-Submission: <%= asset.user.name %>, <%= asset.assignment.title %>
# <% end %>
# turned in: <%= force_zone(asset.submitted_at).strftime("%b %d at %I:%M") rescue "" %><%= force_zone(asset.submitted_at).strftime("%p").downcase rescue "" %>
#

View File

@ -1,24 +0,0 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_submitted.email' do
it "should render" do
@object = submission_model
generate_message(:assignment_submitted, :email, @object)
end
end
# <% define_content :link do %>
# <%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.assignment.context) %>/<%= asset.assignment.context.class.to_s.downcase.pluralize %>/<%= asset.assignment.context_id %>/assignments/<%= asset.assignment_id %>/submissions/<%= asset.user_id %>
# <% end %>
#
# <% define_content :subject do %>
# Submission: <%= asset.user.name %>, <%= asset.assignment.title %>
# <% end %>
#
# <%= asset.user.name %> has just turned in a submission for <%= asset.assignment.title %> in the course <%= asset.assignment.context.name %>.
#
# You can view the submission here:
# <%= content :link %>
#

View File

@ -0,0 +1,13 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_submitted' do
before :once do
submission_model
end
let(:asset) { @submission }
let(:notification_name) { :assignment_submitted }
include_examples "a message"
end

View File

@ -1,14 +0,0 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_submitted.sms' do
it "should render" do
@object = submission_model
generate_message(:assignment_submitted, :sms, @object)
end
end
# <%= asset.user.name %> just turned in their assignment, <%= asset.assignment.title %>
#
# More info at <%= HostUrl.context_host(asset.assignment.context) %>

View File

@ -1,20 +0,0 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_submitted.summary' do
it "should render" do
@object = submission_model
generate_message(:assignment_submitted, :summary, @object)
end
end
# <% define_content :link do %>
# <%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.assignment.context) %>/<%= asset.assignment.context.class.to_s.downcase.pluralize %>/<%= asset.assignment.context_id %>/assignments/<%= asset.assignment_id %>/submissions/<%= asset.user_id %>
# <% end %>
#
# <% define_content :subject do %>
# Submission: <%= asset.user.name %>, <%= asset.assignment.title %>
# <% end %>
# turned in: <%= force_zone(asset.submitted_at).strftime("%b %d at %I:%M") rescue "" %><%= force_zone(asset.submitted_at).strftime("%p").downcase rescue "" %>
#

View File

@ -19,10 +19,13 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_submitted_late.email' do
it "should render" do
describe 'assignment_submitted_late' do
before :once do
submission_model
@object = @submission
generate_message(:assignment_submitted_late, :email, @object)
end
end
let(:asset) { @submission }
let(:notification_name) { :assignment_submitted_late }
include_examples "a message"
end

View File

@ -1,28 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_submitted_late.summary' do
it "should render" do
submission_model
@object = @submission
generate_message(:assignment_submitted_late, :summary, @object)
end
end

View File

@ -1,35 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
sample = File.read("sample.rb")
Dir.glob("../../app/messages/*.erb") do |filename|
original_filename = filename
original_file = File.read(original_filename)
filename = File.split(filename)[-1]
event_name = filename.split(".")[0]
event_type = filename.split(".")[1]
if !File.exist?(filename + "_spec.rb")
f = File.open(filename + "_spec.rb", 'w')
f.puts sample.gsub(/event_name/, event_name).gsub(/event_type/, event_type)
f.puts "\n\n"
f.puts "# " + original_file.gsub("\n", "\n# ")
f.close
puts filename
end
end

View File

@ -1,32 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'collaboration_invitation.email' do
it "should render" do
course_with_student
@collaboration = @course.collaborations.create!(:title => "my collab")
@object = @collaboration.collaborators.create!(:user => @user)
expect(@object.collaboration).not_to be_nil
expect(@object.collaboration.context).not_to be_nil
expect(@object.user).not_to be_nil
generate_message(:collaboration_invitation, :email, @object)
end
end

View File

@ -19,14 +19,15 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'collaboration_invitation.sms' do
it "should render" do
describe 'collaboration_invitation' do
before :once do
course_with_student
@collaboration = @course.collaborations.create!(:user => @user, :title => "my collab")
@object = @collaboration.collaborators.create!(:user => @user)
expect(@object.collaboration).not_to be_nil
expect(@object.collaboration.context).not_to be_nil
expect(@object.user).not_to be_nil
generate_message(:collaboration_invitation, :sms, @object)
end
end
let(:asset) { @object }
let(:notification_name) { :collaboration_invitation }
include_examples "a message"
end

View File

@ -1,32 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'collaboration_invitation.summary' do
it "should render" do
course_with_student
@collaboration = @course.collaborations.create!(:user => @user, :title => "my collab")
@object = @collaboration.collaborators.create!(:user => @user)
expect(@object.collaboration).not_to be_nil
expect(@object.collaboration.context).not_to be_nil
expect(@object.user).not_to be_nil
generate_message(:collaboration_invitation, :summary, @object)
end
end

View File

@ -19,13 +19,19 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'appointment_group_published.sms' do
it "should render" do
user = user_model
appointment_group_model(:contexts => [course_model])
generate_message(:appointment_group_published, :sms, @appointment_group)
expect(@message.body).to include('some title')
describe 'confirm_email_communication_channel' do
before :once do
user_factory
@pseudonym = @user.pseudonyms.create!(unique_id: 'unique@example.com',
password: 'password',
password_confirmation: 'password')
@object = @user.communication_channels.create!(path_type: 'email',
path: 'bob@example.com',
user: @user)
end
let(:asset) { @object }
let(:notification_name) { :confirm_email_communication_channel }
include_examples "a message"
end

View File

@ -19,16 +19,19 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'forgot_password.email' do
it "should render" do
describe 'confirm_registration' do
before :once do
user_factory
@pseudonym = @user.pseudonyms.create!(:unique_id => 'unique@example.com', :password => 'password', :password_confirmation => 'password')
@object = @user.communication_channels.create!(:path_type => 'email', :path => 'bob@example.com', :user => @user)
@object.reload
expect(@user.all_active_pseudonyms.length).to be > 0
expect(@user.all_active_pseudonyms.first.unique_id).not_to be_nil
expect(@user.all_active_pseudonyms.first.managed_password?).to eql(false)
@user.reload
generate_message(:forgot_password, :email, @object)
@pseudonym = @user.pseudonyms.create!(unique_id: 'unique@example.com',
password: 'password',
password_confirmation: 'password')
@object = @user.communication_channels.create!(path_type: 'email',
path: 'bob@example.com',
user: @user)
end
let(:asset) { @object }
let(:notification_name) { :confirm_registration }
include_examples "a message"
end

View File

@ -19,8 +19,8 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'conversation_created.email' do
before do
describe 'conversation_created' do
before :once do
@teacher_enrollment = course_with_teacher
user_enrollment = student_in_course
conversation = @teacher.initiate_conversation([@user])
@ -33,18 +33,20 @@ message")
@message.context_id = account.id
end
it "should render" do
generate_message(:conversation_created, :email, @message)
end
let(:asset) { @message }
let(:notification_name) { :conversation_created }
it "doesnt have trailing erb closures" do
@message.stubs(:attachments).returns([
stub("attachment",
display_name: "FileName", readable_size: "1MB", id: 42,
context: @teacher_enrollment.course, uuid: "abcdef123456")
])
msg = generate_message(:conversation_created, :email, @message)
expect(msg.html_body).to_not match(/%>/)
end
include_examples "a message"
context ".email" do
it "doesnt have trailing erb closures" do
@message.stubs(:attachments).returns([
stub("attachment",
display_name: "FileName", readable_size: "1MB", id: 42,
context: @teacher_enrollment.course, uuid: "abcdef123456")
])
msg = generate_message(:conversation_created, :email, @message)
expect(msg.html_body).not_to match(/%>/)
end
end
end

View File

@ -19,8 +19,8 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'conversation_message.email' do
before do
describe 'conversation_message' do
before :once do
@teacher_enrollment = course_with_teacher
user_enrollment = student_in_course
conversation = @teacher.initiate_conversation([@user])
@ -33,18 +33,22 @@ message")
@message.context_id = account.id
end
it "should render" do
generate_message(:conversation_message, :email, @message)
end
let(:notification_name) { :conversation_message }
let(:asset) { @message }
it "doesnt have trailing erb closures" do
@message.stubs(:attachments).returns([
stub("attachment",
display_name: "FileName", readable_size: "1MB", id: 42,
context: @teacher_enrollment.course, uuid: "abcdef123456")
])
msg = generate_message(:conversation_message, :email, @message)
expect(msg.html_body).to_not match(/%>/)
end
include_examples "a message"
end
context ".email" do
let(:path_type) { :email }
it "doesnt have trailing erb closures" do
@message.stubs(:attachments).returns([
stub("attachment",
display_name: "FileName", readable_size: "1MB", id: 42,
context: @teacher_enrollment.course, uuid: "abcdef123456")
])
msg = generate_message(notification_name, path_type, asset)
expect(msg.html_body).not_to match(/%>/)
end
end
end

View File

@ -1,30 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'conversation_message.sms' do
it "should render" do
course_with_teacher
student_in_course
conversation = @teacher.initiate_conversation([@user])
message = conversation.add_message("some message")
generate_message(:conversation_message, :sms, message)
end
end

View File

@ -1,30 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'conversation_message.summary' do
it "should render" do
course_with_teacher
student_in_course
conversation = @teacher.initiate_conversation([@user])
message = conversation.add_message("some message")
generate_message(:conversation_message, :summary, message)
end
end

View File

@ -1,30 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'conversation_message.twitter' do
it "should render" do
course_with_teacher
student_in_course
conversation = @teacher.initiate_conversation([@user])
message = conversation.add_message("some message")
generate_message(:conversation_message, :twitter, message)
end
end

View File

@ -19,11 +19,15 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'enrollment_accepted.email' do
it "should render" do
course_model(:reusable => true)
describe 'enrollment_accepted' do
before :once do
course_with_student(active_all: true)
user_model
@object = @course.enroll_user(@user)
generate_message(:enrollment_accepted, :email, @object)
end
end
let(:asset) { @object }
let(:notification_name) { :enrollment_accepted }
include_examples "a message"
end

View File

@ -1,29 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'enrollment_accepted.sms' do
it "should render" do
course_model(:reusable => true)
user_model
@object = @course.enroll_user(@user)
generate_message(:enrollment_accepted, :sms, @object)
end
end

View File

@ -1,29 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'enrollment_accepted.summary' do
it "should render" do
course_model(:reusable => true)
user_model
@object = @course.enroll_user(@user)
generate_message(:enrollment_accepted, :summary, @object)
end
end

View File

@ -1,29 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'enrollment_invitation.email' do
it "should render" do
course_with_student(:active_all => true)
@object = @enrollment
expect(@enrollment.context).not_to be_nil
generate_message(:enrollment_invitation, :email, @object)
end
end

View File

@ -19,10 +19,13 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'assignment_created.sms' do
it "should render" do
assignment_model(:title => "Quiz 1")
@object = @assignment
generate_message(:assignment_created, :sms, @object)
describe 'enrollment_invitation' do
before :once do
course_with_student(active_all: true)
end
end
let(:asset) { @enrollment }
let(:notification_name) { :enrollment_invitation }
include_examples "a message"
end

View File

@ -1,29 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'enrollment_invitation.summary' do
it "should render" do
course_with_student(:active_all => true)
@object = @enrollment
expect(@enrollment.context).not_to be_nil
generate_message(:enrollment_invitation, :summary, @object)
end
end

View File

@ -1,37 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'enrollment_notification.email' do
it "should render" do
course_with_student(:active_all => true)
@object = @enrollment
expect(@enrollment.context).not_to be_nil
generate_message(:enrollment_notification, :email, @object)
end
it "should render for creation_pending student" do
course_with_student(:active_course => true, :active_enrollment => true)
@student.communication_channels.create!(:path => 'jacob@instructure.com')
@object = @enrollment
expect(@enrollment.context).not_to be_nil
generate_message(:enrollment_notification, :email, @object)
end
end

View File

@ -19,11 +19,29 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'confirm_email_communication_channel.email' do
it "should render" do
user_factory
@pseudonym = @user.pseudonyms.create!(:unique_id => 'unique@example.com', :password => 'password', :password_confirmation => 'password')
@object = @user.communication_channels.create!(:path_type => 'email', :path => 'bob@example.com', :user => @user)
generate_message(:confirm_email_communication_channel, :email, @object)
describe 'enrollment_notification' do
before :once do
course_with_student(active_all: true)
end
let(:notification_name) { :enrollment_notification }
let(:asset) { @enrollment }
include_examples "a message"
context ".email" do
let(:path_type) { :email }
context "creation_pending student" do
before :once do
@student.communication_channels.create!(path: 'jacob@instructure.com')
end
let(:asset) { @enrollment }
it "should render" do
generate_message(:enrollment_notification, :email, asset)
end
end
end
end

View File

@ -1,29 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'enrollment_notification.sms' do
it "should render" do
course_with_student(:active_all => true)
@object = @enrollment
expect(@enrollment.context).not_to be_nil
generate_message(:enrollment_notification, :sms, @object)
end
end

View File

@ -1,29 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'enrollment_notification.summary' do
it "should render" do
course_with_student(:active_all => true)
@object = @enrollment
expect(@enrollment.context).not_to be_nil
generate_message(:enrollment_notification, :summary, @object)
end
end

View File

@ -1,29 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'enrollment_registration.email' do
it "should render" do
course_with_student(:active_all => true)
@object = @enrollment
expect(@enrollment.context).not_to be_nil
generate_message(:enrollment_registration, :email, @object)
end
end

View File

@ -19,11 +19,13 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'enrollment_invitation.sms' do
it "should render" do
describe 'enrollment_registration' do
before :once do
course_with_student(:active_all => true)
@object = @enrollment
expect(@enrollment.context).not_to be_nil
generate_message(:enrollment_invitation, :sms, @object)
end
end
let(:asset) { @enrollment }
let(:notification_name) { :enrollment_registration }
include_examples "a message"
end

View File

@ -1,29 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'enrollment_registration.sms' do
it "should render" do
course_with_student(:active_all => true)
@object = @enrollment
expect(@enrollment.context).not_to be_nil
generate_message(:enrollment_registration, :sms, @object)
end
end

View File

@ -1,29 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'enrollment_registration.summary' do
it "should render" do
course_with_student(:active_all => true)
@object = @enrollment
expect(@enrollment.context).not_to be_nil
generate_message(:enrollment_registration, :summary, @object)
end
end

View File

@ -19,10 +19,13 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'event_date_changed.sms' do
it "should render" do
describe 'event_date_changed' do
before :once do
calendar_event_model
@object = @event
generate_message(:event_date_changed, :sms, @object)
end
end
let(:asset) { @event }
let(:notification_name) { :event_date_changed }
include_examples "a message"
end

View File

@ -1,28 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'event_date_changed.summary' do
it "should render" do
calendar_event_model
@object = @event
generate_message(:event_date_changed, :summary, @object)
end
end

View File

@ -19,11 +19,19 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'confirm_registration.email' do
it "should render" do
describe 'forgot_password' do
before :once do
user_factory
@pseudonym = @user.pseudonyms.create!(:unique_id => 'unique@example.com', :password => 'password', :password_confirmation => 'password')
@object = @user.communication_channels.create!(:path_type => 'email', :path => 'bob@example.com', :user => @user)
generate_message(:confirm_registration, :email, @object)
@pseudonym = @user.pseudonyms.create!(unique_id: 'unique@example.com',
password: 'password',
password_confirmation: 'password')
@object = @user.communication_channels.create!(path_type: 'email',
path: 'bob@example.com',
user: @user)
end
let(:asset) { @object }
let(:notification_name) { :forgot_password }
include_examples "a message"
end

View File

@ -19,10 +19,13 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'grade_weight_changed.summary' do
it "should render" do
describe 'grade_weight_changed' do
before :once do
course_model(:reusable => true)
@object = @course
generate_message(:grade_weight_changed, :summary, @object)
end
let(:asset) { @course }
let(:notification_name) { :grade_weight_changed }
include_examples "a message"
end

View File

@ -1,29 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'grade_weight_changed.sms' do
it "should render" do
course_model(:reusable => true)
@object = @course
HostUrl.context_host(@object)
generate_message(:grade_weight_changed, :sms, @object)
end
end

View File

@ -1,29 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'group_assignment_submitted_late.email' do
it "should render" do
submission_model
@submission.group = @course.groups.create!
@object = @submission
generate_message(:group_assignment_submitted_late, :email, @object)
end
end

View File

@ -19,11 +19,14 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'group_assignment_submitted_late.sms' do
it "should render" do
describe 'group_assignment_submitted_late' do
before :once do
submission_model
@submission.group = @course.groups.create!
@object = @submission
generate_message(:group_assignment_submitted_late, :sms, @object)
end
end
let(:asset) { @submission }
let(:notification_name) { :group_assignment_submitted_late }
include_examples "a message"
end

View File

@ -1,29 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'group_assignment_submitted_late.summary' do
it "should render" do
submission_model
@submission.group = @course.groups.create!
@object = @submission
generate_message(:group_assignment_submitted_late, :summary, @object)
end
end

View File

@ -19,15 +19,16 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'group_membership_accepted.sms' do
it "should render" do
describe 'group_membership_accepted' do
before :once do
course_model(:reusable => true)
user_model
@group = @course.groups.create!(:name => "student group")
@object = @group.add_user(@user)
expect(@object.user).to eql(@user)
expect(@object.group).to eql(@group)
expect(@object.group.context).to eql(@course)
generate_message(:group_membership_accepted, :sms, @object)
end
let(:asset) { @object }
let(:notification_name) { :group_membership_accepted }
include_examples "a message"
end

Some files were not shown because too many files have changed in this diff Show More