add the json format

This commit is contained in:
Rimian Perkins 2019-08-27 17:29:19 +10:00
parent 4dad8547ca
commit 5724e6d2ed

View File

@ -109,7 +109,7 @@ module DiscourseDonations
end end
it 'enqueues the user account create' do it 'enqueues the user account create' do
post :create, params: params post :create, params: params, format: :json
end end
end end
end end
@ -120,19 +120,19 @@ module DiscourseDonations
before { SiteSetting.stubs(:discourse_donations_enable_create_accounts).returns(true) } before { SiteSetting.stubs(:discourse_donations_enable_create_accounts).returns(true) }
describe 'requires an email' do describe 'requires an email' do
before { post :create, params: params.merge(email: '') } before { post :create, params: params.merge(email: ''), format: :json }
include_examples 'failure response', 'login.missing_user_field' include_examples 'failure response', 'login.missing_user_field'
end end
describe 'requires a username' do describe 'requires a username' do
before { post :create, params: params.merge(username: '') } before { post :create, params: params.merge(username: ''), format: :json }
include_examples 'failure response', 'login.missing_user_field' include_examples 'failure response', 'login.missing_user_field'
end end
describe 'reserved usernames' do describe 'reserved usernames' do
before do before do
User.expects(:reserved_username?).returns(true) User.expects(:reserved_username?).returns(true)
post :create, params: params post :create, params: params, format: :json
end end
include_examples 'failure response', 'login.reserved_username' include_examples 'failure response', 'login.reserved_username'
@ -141,7 +141,7 @@ module DiscourseDonations
describe 'minimum password length' do describe 'minimum password length' do
before do before do
User.expects(:max_password_length).returns(params[:password].length - 1) User.expects(:max_password_length).returns(params[:password].length - 1)
post :create, params: params post :create, params: params, format: :json
end end
include_examples 'failure response', 'login.password_too_long' include_examples 'failure response', 'login.password_too_long'
@ -207,12 +207,12 @@ module DiscourseDonations
end end
it 'awards a group' do it 'awards a group' do
post :create post :create, format: :json
expect(body['rewards']).to include({ 'type' => 'group', 'name' => group_name }) expect(body['rewards']).to include({ 'type' => 'group', 'name' => group_name })
end end
it 'awards a badge' do it 'awards a badge' do
post :create post :create, format: :json
expect(body['rewards']).to include({ 'type' => 'badge', 'name' => badge_name }) expect(body['rewards']).to include({ 'type' => 'badge', 'name' => badge_name })
end end
end end