File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ class Users < Grape::API
188188 requires :id , type : Integer , desc : "User ID"
189189 requires :status , type : String , desc : "User/Agent status"
190190 end
191- patch "/ status/:id/:status " , root : :users do
191+ patch "status/:id" , root : :users do
192192 user = User . where ( id : permitted_params [ :id ] ) . first
193193 user . update! (
194194 status : permitted_params [ :status ]
Original file line number Diff line number Diff line change @@ -212,4 +212,12 @@ def app
212212 assert_equal "anon" , object [ 'login' ]
213213 assert_nil object [ 'city' ]
214214 end
215+
216+ test "API users should be able to set status of users" do
217+ user = User . find ( 6 )
218+ patch "/api/v1/users/status/#{ user . id } .json?status=vacation" , @default_params
219+
220+ object = JSON . parse ( last_response . body )
221+ assert_equal "vacation" , object [ 'status' ]
222+ end
215223end
You can’t perform that action at this time.
0 commit comments