From a114ab211412e38003adcf22d8ffacc91dd66522 Mon Sep 17 00:00:00 2001 From: santiagovidal Date: Wed, 14 Jun 2017 15:01:26 -0300 Subject: [PATCH] Allow user registration to receive first and last name --- apiary.apib | 4 +++- app/controllers/api/v1/registrations_controller.rb | 3 ++- spec/requests/api/v1/users/create_spec.rb | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apiary.apib b/apiary.apib index 06d20ec5..963ad1c1 100644 --- a/apiary.apib +++ b/apiary.apib @@ -18,7 +18,9 @@ API BASE is an internal TopTier project created to facilitate and standardize de "username": "test", "email": "test@gmail.com", "password": "password", - "password_confirmation": "password" + "password_confirmation": "password", + "first_name": "Johhny", + "last_name": "Perez" } } diff --git a/app/controllers/api/v1/registrations_controller.rb b/app/controllers/api/v1/registrations_controller.rb index 54e3a716..e078db4e 100644 --- a/app/controllers/api/v1/registrations_controller.rb +++ b/app/controllers/api/v1/registrations_controller.rb @@ -7,7 +7,8 @@ class RegistrationsController < DeviseTokenAuth::RegistrationsController include Concerns::ActAsApiRequest def sign_up_params - params.require(:user).permit(:email, :password, :password_confirmation, :username) + params.require(:user).permit(:email, :password, :password_confirmation, + :username, :first_name, :last_name) end def render_create_success diff --git a/spec/requests/api/v1/users/create_spec.rb b/spec/requests/api/v1/users/create_spec.rb index 575e2aaa..52e58d73 100644 --- a/spec/requests/api/v1/users/create_spec.rb +++ b/spec/requests/api/v1/users/create_spec.rb @@ -9,6 +9,8 @@ let(:email) { 'test@test.com' } let(:password) { '12345678' } let(:password_confirmation) { '12345678' } + let(:first_name) { 'Johnny' } + let(:last_name) { 'Perez' } let(:params) do { @@ -16,7 +18,9 @@ username: username, email: email, password: password, - password_confirmation: password_confirmation + password_confirmation: password_confirmation, + first_name: first_name, + last_name: last_name } } end