[rspec-users] Trying to write a failing test-- but am failing!

patrick99e99 patrick99e99 at gmail.com
Tue Feb 16 21:02:07 EST 2010


Hi,

> User.create(@invalid_attributes).should be_false # using create
> instead of create!

Hmmm..  when I tried this, I get:

'User should fail when passwords do not match' FAILED
expected #<User id: nil, login: "test_name", crypted_password:
"e75e945946e0b31163c09da22ab0e8b725a89301d82275d0a90...",
password_salt: "ivSY-ZjPwOiOoRfPfvAR", persistence_token:
"9fa3b87bd2b8eb0d2ed600a0009f00ea4224de07954e96d7197...",
single_access_token: "dGscUBSr_qJ3TTcHXpT3", perishable_token: nil,
login_count: 0, failed_login_count: 0, last_request_at: nil,
current_login_at: nil, last_login_at: nil, current_login_ip: nil,
last_login_ip: nil, contact_id: nil, access_level_id: nil, active:
false, created_at: nil, updated_at: nil> to be false

> expect do
>   User.create!(@invalid_attributes)
> end.to raise_exception(ActiveRecord::RecordInvalid)
>

And when I tried it this way, I got the same error as before--

ActiveRecord::RecordInvalid in 'User should create a valid user'
Validation failed: Password doesn't match confirmation

-patrick


More information about the rspec-users mailing list