thoughtbot/shoulda-matchers — pull request #386 by mcmire (2013-11-22 20:52:15+00:00)
Title: Validating presence of a secure password may raise an error

If you have a model that declares `has_secure_password` and you also have a presence validation on the password, and you write a test against this validation using an instance of your model where the password is already set, then your test will fail. This is because has_secure_password (at least on Rails 4) defines #password= such that if it is given nil, then the password will not be overwritten with nil. This interferes with how our validate_presence_of matcher works.

Unfortunately there is not a great way to get around this (using \#write_attribute won't work, either). So in this case we raise a helpful error message that instructs the user to use an empty record against `validates_presence_of`.