add test for email parameter fix

This commit is contained in:
Arpit Jalan 2014-08-06 20:36:06 +05:30
parent b3926efebc
commit 262d4b2fa6
1 changed files with 5 additions and 0 deletions

View File

@ -252,6 +252,11 @@ describe InvitesController do
let(:invitee) { Fabricate(:user) } let(:invitee) { Fabricate(:user) }
let(:invite) { Invite.create!(invited_by: invitee) } let(:invite) { Invite.create!(invited_by: invitee) }
it 'converts "space" to "+" in email parameter' do
Invite.expects(:redeem_from_token).with(invite.invite_key, "fname+lname@example.com", nil, nil, topic.id)
get :redeem_disposable_invite, email: "fname lname@example.com", token: invite.invite_key, topic: topic.id
end
it 'redeems the invite' do it 'redeems the invite' do
Invite.expects(:redeem_from_token).with(invite.invite_key, "name@example.com", nil, nil, topic.id) Invite.expects(:redeem_from_token).with(invite.invite_key, "name@example.com", nil, nil, topic.id)
get :redeem_disposable_invite, email: "name@example.com", token: invite.invite_key, topic: topic.id get :redeem_disposable_invite, email: "name@example.com", token: invite.invite_key, topic: topic.id