Rails: devise validatable unit test always passes when it doesn't work
I'm missing something, but I can't seem to find the problem. This test is really simple and should fail, but it always passes. This creates a user with inappropriate passwords.
I have this in my user model. So I know: validatable is set.
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
When I test it manually using the console it works fine. This will prevent me from storing incorrect passwords.
Here is a unit test:
user = User.new_normal_user(
:email => 'some@email.com',
:password => 'some_password',
:password_confirmation => 'some_other_password'
)
assert user.save
But for some strange reason when running a unit test, it saves when it shouldn't. I'm stumped. I cannot figure it out.
+3
source to share
1 answer