On Jun 20, 2008, at 11:01 AM, Csongor Bartus wrote:
I'm trying "your" way:u = User.create(:login => "test", :email => "[EMAIL PROTECTED]", :password => "test123", :password_confirmation => "test123") u.crypted_password.should_not be_nil the error message is: NoMethodError in 'User ActiveRecord Callbacks before save encrypts password' You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.each ./spec/models/user_spec.rb:82: [line 82 ia User.create(...) and "my" way: @user = User.new @user.login = "test" @user.email = "[EMAIL PROTECTED]" @user.password = "test123" @user.password_confirmation = "test123" @user.save @user.crypted_password.should_not be_nil the error message is: 'User Acts As Authenticated encrypts password' FAILED expected not nil, got nil
Try using create! or save! - I'll bet the record is not being saved correctly and you're not seeing the error.
_______________________________________________ rspec-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/rspec-users
