Passing the Request Test
Let’s learn how to implement the code to pass the test.
We'll cover the following...
Why did the test fail?
Now, we need to find out why the test is failing.
We could look at the test.log
file, but it’s of no help in this case. So, we’ll have to check out the registrations controller. To do that, we’’ll use the generator that Devise provides.
$ rails g devise:controllers users -c=registrations
create app/controllers/users/registrations_controller.rb
The generator also gives us some code to add into our config/routes.rb
file.
Press + to interact
Rails.application.routes.draw dodevise_for :users, controllers: {registrations: 'users/registrations'}root "site#index"end
It’s now a lot easier to see what happens with the request.
Let’s uncomment the create
action in the registrations controller and add a breakpoint (with pry).
Press + to interact
def createrequire "pry"; binding.prysuperend
The test should now stop at the breakpoint we’ve just ...