Casecommons/with_model — Issue #8:  ActiveRecord model with has_secure_password causes errors
Author: namick
Created: 2012-02-28 21:07:44+00:00
State: open

Great library, very useful! I did however run into one problem.

While trying to test an ActiveRecord model with has_secure_password:
https://github.com/rails/rails/blob/master/activemodel/lib/active_model/secure_password.rb

I am getting the following error:

Failures:

1) ActiveRecord behaviors with has_secure_password should be able to be authenticated
Failure/Error: user = User.create!(:email => 'test@test.com', :password => 'foobar', :password_confirmation => 'foobar')
ActiveRecord::StatementInvalid:
NoMethodError: undefined method `error' for nil:NilClass: INSERT INTO "with_model_users_27596" ("email", "password_digest") VALUES (?, ?)

I created a failing spec here:

https://github.com/namick/with_model/commit/861a1a4eef042db411f26a95aea46742d525dc77

I am not sure if it is something I am doing wrong or just an edge case... If you can point me in the right direction as to why this might be happening, im happy to fix it and give you a pull request on it.

Cheers