mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
Update username should return a json response
- Have update username return json response that contains the updated username and id. I figured this would be better than just return "OK". - Add test to verify that the new username is returned.
This commit is contained in:
parent
6027073547
commit
02ade72ceb
2 changed files with 9 additions and 1 deletions
|
@ -91,7 +91,10 @@ class UsersController < ApplicationController
|
|||
result = user.change_username(params[:new_username])
|
||||
raise Discourse::InvalidParameters.new(:new_username) unless result
|
||||
|
||||
render nothing: true
|
||||
render json: {
|
||||
id: user.id,
|
||||
username: user.username
|
||||
}
|
||||
end
|
||||
|
||||
def check_emails
|
||||
|
|
|
@ -636,6 +636,11 @@ describe UsersController do
|
|||
response.should be_success
|
||||
end
|
||||
|
||||
it 'should return a JSON response with the updated username' do
|
||||
xhr :put, :username, username: user.username, new_username: new_username
|
||||
::JSON.parse(response.body)['username'].should == new_username
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue