Machinist - having problems stubbing an after_create filter

Hi all

I’m moving to using Machinist in my rspec tests and am having a problem
with an after_create callback method that i need to stub out. It seems
like calling ClassName.make will trigger this callback before i’ve had
the chance to stub it.

Can i stub it in my blueprint for that class? Or, can i stub the method
for all instances of the class before i call ClassName.make?

Hey Max,

Try:

instance = YourModel.make_unsaved

then stub the after_create method and save the object.

Regards,
Gustav P.

On Tue, Jul 21, 2009 at 5:50 PM, Max W. <

Gustav P. wrote:

Hey Max,

Try:

instance = YourModel.make_unsaved

then stub the after_create method and save the object.

Regards,
Gustav P.

On Tue, Jul 21, 2009 at 5:50 PM, Max W. <

aha! If only there was an rdoc for the version of machinist i have
installed i could have found that myself.

Thanks a lot!
max

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs