> In rspec-mocks, when you say Klass.stub(:new), Klass.new returns a proxy, not > an instance of the Klass. I'm pretty sure the same is true of mocha.
Ok-- I guess I wasn't realizing that Klass.expects(:new) was actually stubbing the class.. I was thinking it was doing something like making a duplicate of the initialize method (making it something like "_initialize") and then overwriting the real initialize method with something that calls _initialize but also sets a flag to indicate that .new had been called... So that's apparently not quite the case? In any event, after reading what you wrote I got my test to pass by doing: PostSharer.expects(:new).once.returns stub("Fake Post Sharer", :perform => true) So this way delayed_job still can call perform on the fake object and everyone is happy (especially me). Patrick J. Collins http://collinatorstudios.com _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users