forked from expertiza/expertiza
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding rspec test file for invitations_controller for mailers
- Loading branch information
1 parent
37f672e
commit 9e9e495
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
require 'rspec' | ||
|
||
describe InvitationsController do | ||
describe "invitation request" do | ||
context "when an user sends an invitation" do | ||
it "calls the send_mail_about_invitation method" do | ||
expect(send_mail_about_invitation).with(AssignmentParticipant.find(params[:student_id][:email]),params[:student | ||
][:email],"invitation_pending") | ||
end | ||
end | ||
|
||
context "when an user accepts an invitation" do | ||
it "calls the send_mail_about_invitation method" do | ||
expect(send_mail_about_invitation).with(AssignmentParticipant.find(params[:student_id][:email]),params[:student | ||
][:email],"invitation_accepted") | ||
end | ||
end | ||
|
||
context "when an user declines an invitation" do | ||
it "calls the send_mail_about_invitation method" do | ||
expect(send_mail_about_invitation).with(AssignmentParticipant.find(params[:student_id][:email]),params[:student | ||
][:email],"invitation_declined") | ||
end | ||
end | ||
end | ||
|
||
describe "create invitation" do | ||
it "should deliver an invitation an invitation mail to user" do | ||
invitation_attributes = FactoryGirl.attributes_for(:to,:body) | ||
mailer = mock(mailer) | ||
mailer.should_receive(:deliver).with(send_mail_about_invitation(invitation_attributes)) | ||
end | ||
end | ||
|
||
describe "respond invitation" do | ||
it "should deliver a response mail to user" do | ||
invitation_attributes = FactoryGirl.attributes_for(:to,:body) | ||
mailer = mock(mailer) | ||
mailer.should_receive(:deliver).with(send_mail_about_invitation(invitation_attributes)) | ||
end | ||
end | ||
|
||
|
||
end |