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

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


> 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:
password_salt: "ivSY-ZjPwOiOoRfPfvAR", persistence_token:
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


More information about the rspec-users mailing list