[rspec-users] before_save model callback rspec testing

Csongor Bartus lists at ruby-forum.com
Mon Jun 23 10:59:46 EDT 2008


Yi Wen wrote:
> fire up script/console and copy line 82 and try it out. and report the
> result here.

>> u = User.create!(:login => "test", :email => "test at test.com", :password => "test123", :password_confirmation => "test123")
NoMethodError: 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
        from 
./script/../config/../config/../vendor/rails/activerecord/lib/active_record/base.rb:1671:in 
`attributes='
        from 
./script/../config/../config/../vendor/rails/activerecord/lib/active_record/base.rb:1505:in 
`initialize_without_callbacks'
        from 
./script/../config/../config/../vendor/rails/activerecord/lib/active_record/callbacks.rb:225:in 
`initialize'
        from 
./script/../config/../config/../vendor/rails/activerecord/lib/active_record/validations.rb:726:in 
`new'
        from 
./script/../config/../config/../vendor/rails/activerecord/lib/active_record/validations.rb:726:in 
`create!'
        from (irb):1
>> 
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list