[rspec-users] Is #valid? automatically called?

Scott Taylor scott at railsnewbie.com
Fri Feb 13 00:45:02 EST 2009

Mark Wilden wrote:
> It seems logical that #errors_on would call valid? Otherwise, how would it know?
That intuitively makes sense.

The reason the whole issue is confusing is because of AR's behaviour:

 >> User.new.valid?
=> false
 >> User.new.errors.to_a
=> []

errors_on(:foo) looks like it'll call errors.on(:foo), which returns nil 
if valid? isn't called.


> ///ark
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list