Forum: Ruby on Rails model test

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Arshak N. (Guest)
on 2009-02-22 19:16
Hello,

I have a before_validation_on_create callback on one of my models.  It
works fine when I run it through the console in dev/prod but in test
(also going against mysql) it doesn't seem to fire.

Anything special about rake test and callbacks?

Thanks,

Arshak
Phlip (Guest)
on 2009-02-22 20:30
(Received via mailing list)
Arshak N. wrote:
> Hello,
>
> I have a before_validation_on_create callback on one of my models.  It
> works fine when I run it through the console in dev/prod but in test
> (also going against mysql) it doesn't seem to fire.

Post your test code. It should raise an exception on create! , and
should return
nil on create(). So if you miss either of those, the validation appears
to not work.
This topic is locked and can not be replied to.