Hi there,
I’m trying to use shoulda-matchers to test a User model which is powered by Devise.
I’ve got the following code in my User spec:
describe User do
it { should_not allow_value('bad_word').for(:bio) }
...
end
When I run the spec, I get the following error:
Failure/Error: it { should_not allow_value('bad_word').for(:bio) }
Expected errors when bio is set to "bad_word", got errors: ["email can't be blank (\"\")", "password can't be blank (nil)"]
It looks like Devise is catching the email and password validations before even getting a chance to spit out an error for the lack of bio validation.
Is there a way that I can make Shoulda set an email/password before hand so that it can get past this?
Any suggestions would be greatly appreciated.
Thanks!