check for empty email

This commit is contained in:
Rimian Perkins 2017-04-05 09:49:57 +10:00
parent 3306c44f1f
commit 66094fdfdd
3 changed files with 4 additions and 6 deletions

View File

@ -7,10 +7,8 @@ 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 = { response = {}
}
else else
Stripe.api_key = SiteSetting.discourse_donations_secret_key Stripe.api_key = SiteSetting.discourse_donations_secret_key
currency = SiteSetting.discourse_donations_currency currency = SiteSetting.discourse_donations_currency

View File

@ -1,6 +1,6 @@
# name: discourse-donations # name: discourse-donations
# about: Integrating Discourse with Stripe for donations # about: Integrating Discourse with Stripe for donations
# version: 1.7.2 # version: 1.7.3
# url: https://github.com/choiceaustralia/discourse-donations # url: https://github.com/choiceaustralia/discourse-donations
# authors: Rimian Perkins # authors: Rimian Perkins

View File

@ -15,7 +15,7 @@ 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, { email: '' }
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
end end