Guest User

Untitled

a guest
Nov 21st, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. ActionController::UrlGenerationError:
  2. No route matches {:action=>"create", :controller=>"user/registrations", :user=>{:name=>"Adriane Koepp", :city=>"Nidiafurt", :address=>"14955 Cormier Viaduct", :country=>"Mozambique", :email=>"moshe@kozey.com", :phone_primary=>"(295) 491-0447 x9108", :phone_secondary=>"536.985.9499 x7264", :postal_code=>"93438-7448", :province=>"South Carolina", :password=>"MaH9R5G8XqB", :pets_attributes=>[{:name=>"Patches", :chip_number=>"149793073311890", :species=>"iusto"}]}}
  3.  
  4. it 'creates a new User' do
  5. expect do
  6. post :create, params: { user: valid_attributes }
  7. end.to change(User, :count).by(1)
  8. end
  9.  
  10. devise_for :users, controllers: {
  11. registration: 'user/registration'
  12. }
  13.  
  14. 1) User::RegistrationsController POST #create with valid params creates a new User
  15. Failure/Error: post :create, params: { user: valid_attributes }
  16.  
  17. AbstractController::ActionNotFound:
  18. Could not find devise mapping for path "/users".
  19. This may happen for two reasons:
  20.  
  21. 1) You forgot to wrap your route inside the scope block. For example:
  22.  
  23. devise_scope :user do
  24. get "/some/route" => "some_devise_controller"
  25. end
  26.  
  27. 2) You are testing a Devise controller bypassing the router.
  28. If so, you can explicitly tell Devise which mapping to use:
  29.  
  30. @request.env["devise.mapping"] = Devise.mappings[:user]
  31.  
  32. # routes.rb
  33. devise_for :users, controllers: {
  34. registrations: 'user/registrations'
  35. }
Add Comment
Please, Sign In to add comment