add a couple specs
This commit is contained in:
parent
6dd58fe875
commit
bfa0917ce4
2 changed files with 12 additions and 2 deletions
|
|
@ -21,12 +21,16 @@ describe InvitationsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#create" do
|
describe "#create" do
|
||||||
|
|
||||||
it 'invites the requested user' do
|
it 'invites the requested user' do
|
||||||
user.should_receive(:invite_user).once
|
user.should_receive(:invite_user).once
|
||||||
post :create, "user"=>{"invite_messages"=>"test", "aspects"=> aspect.id.to_s, "email"=>"abc@example.com"}
|
post :create, :user=>{:invite_messages=>"test", :aspects=> aspect.id.to_s, :email=>"abc@example.com"}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'creates an invitation' do
|
||||||
|
lambda{
|
||||||
|
post :create, :user=>{:invite_messages=>"test", :aspects=> aspect.id.to_s, :email=>"abc@example.com"}
|
||||||
|
}.should change(Invitation, :count).by(1)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,12 @@ describe Invitation do
|
||||||
Invitation.create_invitee(:email => @email)
|
Invitation.create_invitee(:email => @email)
|
||||||
}.should change{Devise.mailer.deliveries.size}.by(1)
|
}.should change{Devise.mailer.deliveries.size}.by(1)
|
||||||
end
|
end
|
||||||
|
it 'sends an email that includes the right things' do
|
||||||
|
Devise.mailer.deliveries = []
|
||||||
|
Invitation.create_invitee(:email => @email)
|
||||||
|
Devise.mailer.deliveries.first.to_s.include?("Hello #{@email}").should == true
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#to_request!' do
|
describe '#to_request!' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue