mirror of
https://github.com/discourse/discourse-subscriptions.git
synced 2025-07-08 07:12:46 +00:00
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]
|
skip_before_filter :verify_authenticity_token, only: [:create]
|
||||||
|
|
||||||
def create
|
def create
|
||||||
if email.nil?
|
if email.nil? || email.empty?
|
||||||
response = {'message' => 'Please enter your email address'}
|
response = {'message' => 'Please enter your email address'}
|
||||||
elsif create_account && params[:username].nil?
|
elsif create_account && params[:username].nil?
|
||||||
response = {'message' => 'Please enter a username'}
|
response = {'message' => 'Please enter a username'}
|
||||||
|
@ -17,7 +17,13 @@ module DiscourseDonations
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'responds ok when the email is empty' do
|
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(body['message']).to eq('Please enter your email address')
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user