Skip to content

Commit

Permalink
Merge pull request #57 from toptier/bug/missing_name_params
Browse files Browse the repository at this point in the history
Allow user registration to receive first and last name
  • Loading branch information
Matías Mansilla authored Jun 19, 2017
2 parents 2eebd38 + a114ab2 commit 172a237
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion apiary.apib
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

Expand Down
3 changes: 2 additions & 1 deletion app/controllers/api/v1/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion spec/requests/api/v1/users/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@
let(:email) { 'test@test.com' }
let(:password) { '12345678' }
let(:password_confirmation) { '12345678' }
let(:first_name) { 'Johnny' }
let(:last_name) { 'Perez' }

let(:params) do
{
user: {
username: username,
email: email,
password: password,
password_confirmation: password_confirmation
password_confirmation: password_confirmation,
first_name: first_name,
last_name: last_name
}
}
end
Expand Down

0 comments on commit 172a237

Please sign in to comment.