Rob Lacey wrote:
Hi there,

I'm trying to write a spec for and existing model. It has an after_create callback which I'd like to stub out. Any quick solution to this?

Many thanks

Rob Lacey
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

What you may want to do is move the after_create into an observer and then disconnect your observers during most of your specs. You can do this with Pat Maddox's plugin:
http://evang.eli.st/blog/2007/11/22/better-rails-testing-decoupling-observers
http://github.com/pat-maddox/no-peeping-toms/tree/master

-Ben
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to