There's a Bug
Explore the process of catching and fixing bugs in Ruby on Rails request tests. Learn to handle unpermitted parameters, update views with user variables, and adjust controllers to permit necessary attributes. This lesson deepens your understanding of behavior-driven development and ensures your app behaves as expected.
We'll cover the following...
We'll cover the following...
Catching bugs
It should be clear at this point that there’s a bug in the code.
--require spec_helper
The request test
If we look at the test.log file more closely, we’ll see a warning just under the parameters line. It says "Unpermitted parameter: :name".
Parameters: {"utf8"=>"✓", "user"=>{"email"=>"jdoe@example.com", "name"=>"jdoe", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up"}
Unpermitted parameter: :name
That means that ...