On Tuesday, July 22, 2014 8:23:07 AM UTC+2, Roelof Wobben wrote:
>
> Hello, 
>
> I do still follow the Hartl tutorial. 
> Am at chapter 6 and according to the manual the test schould be 
> successfull but I see these error messages: 
>
>
> Failures:                                                                     
>                                                                               
>                                                                               
>           
>
>                                                                               
>                                                                               
>                                                                               
>           
>
>   1) User when password doesn't match confirmation return value of 
> authenticate method with valid password                                       
>                                                                               
>                      
>      Failure/Error: 
> it { should eq found_user.authenticate(@user.password) }
>                                                                               
>                                                                               
>             
>      NoMethodError
> :                                                                             
>                                                                               
>                                                                       
>        undefined method `authenticate' for nil:NilClass
>                                                                               
>                                                                               
>                                  
>
>      # ./spec/models/user_spec.rb:91:in `block (5 levels) in <top (required)>'
>      
>
> You can find my code here :  
> https://github.com/roelof1967/sample_app_nutrious/tree/chapter_six
>
> Roelof
>

The error comes from the lien 91.

let(:found_user) { User.find_by(email: @user.email) }

Try to replace it as follows:

let(:found_user) { User.find_by_email(@user.email) 

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/d945fb01-2370-4b03-9460-3b3801ecad74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to