On Tue, Aug 26, 2008 at 10:03 PM, David Chelimsky <[EMAIL PROTECTED]> wrote: > On Tue, Aug 26, 2008 at 8:51 PM, Mark Wilden <[EMAIL PROTECTED]> wrote: >> On Tue, Aug 26, 2008 at 5:01 PM, David Chelimsky <[EMAIL PROTECTED]> >> wrote: >> >>> >>> @target_comment = stub_model(Target) >>> @target.stub!(:comments).and_return([EMAIL PROTECTED]) >> >> That's what we do - what would the drawbacks be? > > It's more invasive than I'd like. It's not all that risky though. I > just feel dirty whenever I mock methods on the objects I'm focused on. > FWIW.
A similar approach I've used when I'm not utilizing custom SQL logic (that requires hitting the database) which is less "dirty" IMO than modifying the object you're focusing on is: comments = [stub_model(Target)] @target.comments = comments -- Zach Dennis http://www.continuousthinking.com http://www.mutuallyhuman.com -- Zach Dennis http://www.continuousthinking.com http://www.mutuallyhuman.com _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users