[rspec-users] How do you stub out callbacks?

Ben Mabey ben at benmabey.com
Thu Aug 14 12:50:31 EDT 2008

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 at 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:


More information about the rspec-users mailing list