Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def update
if @user.update(user_params)
respond_to do |format|
format.html { redirect_to @user }
format.json { head :no_content }
format.json { render :show }
end
else
respond_to do |format|
Expand Down
2 changes: 1 addition & 1 deletion docs/api/sections/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ __Request:__

__Response:__

Returns `204 No Content` on success.
Returns `200 OK` with the updated user in the same shape as `GET /:account_slug/users/:user_id`.

## `DELETE /:account_slug/users/:user_id/avatar`

Expand Down
6 changes: 5 additions & 1 deletion test/controllers/users_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,12 @@ class UsersControllerTest < ActionDispatch::IntegrationTest

put user_path(users(:david)), params: { user: { name: "New David" } }, as: :json

assert_response :no_content
assert_response :success
assert_equal "New David", users(:david).reload.name

json = @response.parsed_body
assert_equal users(:david).id, json["id"]
assert_equal "New David", json["name"]
end

test "update as JSON with invalid avatar returns errors" do
Expand Down
Loading