add a test for ensure do not invite someone more than once

This commit is contained in:
szpyxlwoni
2012-11-27 13:53:06 +08:00
parent 6fcde56593
commit 85492000f5
+8 -1
View File
@@ -29,7 +29,7 @@ describe Membership do
end.should change(Membership, :count).by(1)
end
it 'ensure do not invite someone who has a pending membership with a team' do
it 'ensure do not invite someone who joined that team' do
@invitee.teams << @team
lambda do
Membership.create_pending_membership(@inviter, @invitee, @team)
@@ -41,5 +41,12 @@ describe Membership do
Membership.create_pending_membership(@inviter, @inviter, @team)
end.should_not change(Membership, :count)
end
it 'ensure do not invite someone more than once' do
Membership.create team: @team, person: @invitee,pending_approval_token: uuid
lambda do
Membership.create_pending_membership(@inviter, @invitee, @team)
end.should_not change(Membership, :count)
end
end
end