invitation emails stripped of whitespace from form
This commit is contained in:
parent
2c5d5d9328
commit
6f62161442
2 changed files with 6 additions and 1 deletions
|
|
@ -19,7 +19,7 @@ class InvitationsController < Devise::InvitationsController
|
||||||
end
|
end
|
||||||
aspect = params[:user].delete(:aspects)
|
aspect = params[:user].delete(:aspects)
|
||||||
message = params[:user].delete(:invite_messages)
|
message = params[:user].delete(:invite_messages)
|
||||||
emails = params[:user][:email].split(/, */)
|
emails = params[:user][:email].to_s.gsub(/\s/, '').split(/, */)
|
||||||
|
|
||||||
good_emails, bad_emails = emails.partition{|e| e.try(:match, Devise.email_regexp)}
|
good_emails, bad_emails = emails.partition{|e| e.try(:match, Devise.email_regexp)}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,11 @@ describe InvitationsController do
|
||||||
post :create, :user => @invite.merge(:email => "foofoofoofoo@example.com, mbs@gmail.com")
|
post :create, :user => @invite.merge(:email => "foofoofoofoo@example.com, mbs@gmail.com")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'can handle a comma seperated list of emails with whitespace' do
|
||||||
|
Resque.should_receive(:enqueue).twice()
|
||||||
|
post :create, :user => @invite.merge(:email => "foofoofoofoo@example.com , mbs@gmail.com")
|
||||||
|
end
|
||||||
|
|
||||||
it 'displays a message that tells you how many invites were sent, and which REJECTED' do
|
it 'displays a message that tells you how many invites were sent, and which REJECTED' do
|
||||||
post :create, :user => @invite.merge(:email => "mbs@gmail.com, foo@bar.com, foo.com, lala@foo, cool@bar.com")
|
post :create, :user => @invite.merge(:email => "mbs@gmail.com, foo@bar.com, foo.com, lala@foo, cool@bar.com")
|
||||||
flash[:error].should_not be_empty
|
flash[:error].should_not be_empty
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue