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
|
||||
|
||||
describe "#create" do
|
||||
|
||||
it 'invites the requested user' do
|
||||
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
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -99,6 +99,12 @@ describe Invitation do
|
|||
Invitation.create_invitee(:email => @email)
|
||||
}.should change{Devise.mailer.deliveries.size}.by(1)
|
||||
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
|
||||
|
||||
describe '#to_request!' do
|
||||
|
|
|
|||
Loading…
Reference in a new issue