check email is not empty
This commit is contained in:
parent
6717317717
commit
aaff445019
|
@ -7,7 +7,7 @@ module DiscourseDonations
|
|||
skip_before_filter :verify_authenticity_token, only: [:create]
|
||||
|
||||
def create
|
||||
if email.nil?
|
||||
if email.nil? || email.empty?
|
||||
response = {'message' => 'Please enter your email address'}
|
||||
elsif create_account && params[:username].nil?
|
||||
response = {'message' => 'Please enter a username'}
|
||||
|
|
|
@ -17,7 +17,13 @@ module DiscourseDonations
|
|||
end
|
||||
|
||||
it 'responds ok when the email is empty' do
|
||||
post :create, { }
|
||||
post :create, { create_account: 'true', email: '' }
|
||||
expect(body['message']).to eq('Please enter your email address')
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
||||
it 'responds ok when the email is empty' do
|
||||
post :create, { create_account: 'false' }
|
||||
expect(body['message']).to eq('Please enter your email address')
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue