diff --git a/app/controllers/platform/api/v1/users_controller.rb b/app/controllers/platform/api/v1/users_controller.rb index bf5b642f8..c9f256c6f 100644 --- a/app/controllers/platform/api/v1/users_controller.rb +++ b/app/controllers/platform/api/v1/users_controller.rb @@ -7,8 +7,8 @@ class Platform::Api::V1::UsersController < PlatformController def create @resource = (User.find_by(email: user_params[:email]) || User.new(user_params)) + @resource.skip_confirmation! @resource.save! - @resource.confirm @platform_app.platform_app_permissibles.find_or_create_by!(permissible: @resource) end diff --git a/spec/controllers/platform/api/v1/users_controller_spec.rb b/spec/controllers/platform/api/v1/users_controller_spec.rb index cc6fe448f..e2e9d17df 100644 --- a/spec/controllers/platform/api/v1/users_controller_spec.rb +++ b/spec/controllers/platform/api/v1/users_controller_spec.rb @@ -95,9 +95,11 @@ RSpec.describe 'Platform Users API', type: :request do let(:platform_app) { create(:platform_app) } it 'creates a new user and permissible for the user' do - post '/platform/api/v1/users/', params: { name: 'test', email: 'test@test.com', password: 'Password1!', - custom_attributes: { test: 'test_create' } }, - headers: { api_access_token: platform_app.access_token.token }, as: :json + expect do + post '/platform/api/v1/users/', params: { name: 'test', email: 'test@test.com', password: 'Password1!', + custom_attributes: { test: 'test_create' } }, + headers: { api_access_token: platform_app.access_token.token }, as: :json + end.not_to enqueue_mail expect(response).to have_http_status(:success) data = JSON.parse(response.body)