FEATURE: allow staff to send multiple invites to same email

This commit is contained in:
Arpit Jalan
2014-07-29 23:27:08 +05:30
parent b942436d7b
commit f571abfaaf
5 changed files with 37 additions and 1 deletions

View File

@ -53,6 +53,14 @@ describe InvitesController do
response.should_not be_success
end
it "fails for normal user if invite email already exists" do
user = log_in(:elder)
invite = Invite.invite_by_email("invite@example.com", user)
invite.reload
post :create, email: invite.email
response.should_not be_success
end
it "allows admins to invite to groups" do
group = Fabricate(:group)
log_in(:admin)
@ -60,6 +68,14 @@ describe InvitesController do
response.should be_success
Invite.find_by(email: email).invited_groups.count.should == 1
end
it "allows admin to send multiple invites to same email" do
user = log_in(:admin)
invite = Invite.invite_by_email("invite@example.com", user)
invite.reload
post :create, email: invite.email
response.should be_success
end
end
end