I have finished Chapter 6 of railstutorial but all my User model specs have started failing soon after I added password & password_confirmation
I ended up spending a few hours and couldn't find any answers. My problem ended up being on the downcase line:
before_save { self.email = email.downcase }
He specifies that you can do this line in a different way which I did. See below.
https://www.railstutorial.org/book/_single-page#sec-creating_and_authenticating_a_user
In Listing 6.31, we could have written the assignment as self.email = self.email.downcase (where self refers to the current user), but inside the User model the self keyword is optional on the right-hand side: self.email = email.downcase
Don't do it this way. It gave me error messages every time until I reverted to
before_save { self.email = email.downcase }
and removed:
self.email = self.email.downcase
I'm a noob so not completely sure why this made the difference but it did.