1
0
mirror of synced 2026-08-06 15:16:56 +00:00

check email is not empty

This commit is contained in:
Rimian Perkins
2017-04-04 14:34:33 +10:00
parent 6717317717
commit aaff445019
2 changed files with 8 additions and 2 deletions
@@ -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