Can’t Resolve Failing Test on RailsTutorial, Chapter 12

Hello everyone,

I'm on chapter 12 and I can't figure out why I'm getting this error:

ERROR["test_password_resets", PasswordResetsTest, 3.767541999986861]
test_password_resets#PasswordResetsTest (3.77s)
NoMethodError: NoMethodError: undefined method `document' for nil:NilClass
test/integration/password_resets_test.rb:46:in `block in '

There seems to be some conflict with

assert_select 'div#error_explanation’

Here’s a video of the failing test:

Any help would be appreciated!

2 thoughts on “Can’t Resolve Failing Test on RailsTutorial, Chapter 12”

  1. Can’t see specifically from what you posted, but the error indicates that whatever you are calling “.document” on doesn’t exist.

    That’s that “‘document’ for nil:Nilclass error”. The object itself doesn’t exist (is nil).

  2. The text is too small in the video, if you post the code it would be more helpful, it’s not a failing test but an error, follow your stack trace from where you are calling the document method, binding.pry might come in handy here.


Leave a Comment