Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. def update
  2. if check_token?
  3. @user.update(user_params)
  4. head :no_content
  5. end
  6. end
  7.  
  8. describe 'PUT /users/:id' do
  9. let!(:user) { User.create(id: 1, email: 'test@mail.ru', password: 'abc123') }
  10.  
  11. context '# check success update' do
  12. before(:each) do
  13. patch :update, { user: { id: 1, email: 'newmail@example.com' } }
  14. end
  15.  
  16. it 'returns status code 204' do
  17. expect(response).to have_http_status(204)
  18. end
  19.  
  20. end
  21. end #<-- end of PUT /users/:id
  22.  
  23. Failures:
  24.  
  25. 1) UsersController PUT /users/:id # check success update returns status code 204
  26. Failure/Error: patch :update, { user: { id: 1, email: 'newmail@example.com' } }
  27.  
  28. ArgumentError:
  29. unknown keyword: user
  30. # ./spec/controllers/users_controller_spec.rb:37:in `block (4 levels) in <top (required)>'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement