1
0
mirror of synced 2026-08-05 06:36:55 +00:00

permit params

This commit is contained in:
Rimian Perkins
2017-05-17 14:17:37 +10:00
parent 05c31f1909
commit cb03671c19
2 changed files with 7 additions and 0 deletions
@@ -7,6 +7,8 @@ module DiscourseDonations
skip_before_filter :verify_authenticity_token, only: [:create]
def create
params.permit(:name, :username, :email, :password)
output = { 'messages' => [], 'rewards' => [] }
if create_account
@@ -23,6 +23,11 @@ module DiscourseDonations
SiteSetting.stubs(:discourse_donations_currency).returns('AUD')
end
it 'whitelists the params' do
params = { email: 'email@example.com', password: 'secret', username: 'mr-pink', name: 'kirsten' }
should permit(:name, :username, :email, :password).for(:create, params: params)
end
it 'responds ok for anonymous users' do
post :create, { email: 'foobar@example.com' }
expect(body['messages']).to include(I18n.t('donations.payment.success'))