我正在尝试通过更新操作手动更新用户。
我在 spec/requests/user_request_spec.rb 中尝试了以下代码行:
user = create(:user, username: "username", password: "secret", password_confirmation: "secret") #Factory Girl
attr = { username: "newusername" }
put :update, :id => user.id, :user => attr
我收到以下错误:
Failure/Error: put :update, :id => user.id, :user => attr
ArgumentError:
bad argument (expected URI object or URI string)
# ./spec/requests/users_request_spec.rb:55:in `block (3 levels) in <top (required)>'
如何通过 rspec 发送更新用户的请求?