forked from diaspora/diaspora
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better error messages for folks coming in with a bad invitation token…
…, whether by clicking the "view this invitation in your browser" link or by clicking the accept invitation button. Get rid of 500 error on the "view this invitation in your browser" link
- Loading branch information
Sarah Mei & Tim Frazer
committed
Nov 15, 2011
1 parent
ebad0f5
commit e38cb41
Showing
5 changed files
with
30 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.span-15.last | ||
%h2 | ||
= t('devise.invitations.invitation_token_invalid') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,20 +24,20 @@ | |
request.env["HTTP_REFERER"]= 'http://test.host/cats/foo' | ||
end | ||
|
||
it 'saves and invitation' do | ||
it 'saves an invitation' do | ||
expect { | ||
post :create, :user => @invite | ||
}.should change(Invitation, :count).by(1) | ||
end | ||
|
||
it 'handles a comma seperated list of emails' do | ||
it 'handles a comma-separated list of emails' do | ||
expect{ | ||
post :create, :user => @invite.merge( | ||
:email => "[email protected], [email protected]") | ||
}.should change(Invitation, :count).by(2) | ||
end | ||
|
||
it 'handles a comma seperated list of emails with whitespace' do | ||
it 'handles a comma-separated list of emails with whitespace' do | ||
expect { | ||
post :create, :user => @invite.merge( | ||
:email => "[email protected] , [email protected]") | ||
|
@@ -70,6 +70,24 @@ | |
end | ||
end | ||
|
||
describe "#email" do | ||
before do | ||
invites = Invitation.batch_invite(["[email protected]"], :message => "hi", :sender => @user, :aspect => @user.aspects.first, :service => 'email', :language => "en-US") | ||
invites.first.send! | ||
@invited_user = User.find_by_email("[email protected]") | ||
end | ||
|
||
it "succeeds" do | ||
get :email, :invitation_token => @invited_user.invitation_token | ||
response.should be_success | ||
end | ||
|
||
it "shows an error if there's no such invitation token" do | ||
get :email, :invitation_token => 12345 | ||
response.should render_template(:token_not_found) | ||
end | ||
end | ||
|
||
describe "#update" do | ||
before do | ||
invite = Factory(:invitation, :sender => @user, :service => 'email', :identifier => "[email protected]") | ||
|