Sure!

Start here, with the creators and maintainers of the feature: https://github.com/rspec/rspec-mocks/issues/336

This is not rspec-specific, but some details: http://jamesmead.org/blog/2007-11-29-mock-object-injection

My opinion: you do this because you can’t get at the model itself to stub it, so you stub all instances of the model to work around this limitation. You can pass in a collaborator which would have access to those models.  

On Thursday, February 13, 2014 at 11:44 AM, Jason Perez wrote:

> In spec/sales_person_spec.rb:
> > subject.route.should eq(route_stub) > end > + > + it "should allow for the starting point to be specified" do > + city = double > + subject.schedule_city(city, starting_city: true) > + subject.starting_city.should eq(city) > + end > + > + it "should calculate total miles traveled via Route" do > + Route.any_instance.should_receive(:miles_traveled)  
> @jwo (https://github.com/jwo) Do you have any additional info on why "any_instance" is a code smell (like a quick note or a link)? I've been thinking about this one and perhaps I don't understand the problem to begin with. Thanks!
>  
> —
> Reply to this email directly or view it on GitHub (https://github.com/RubyoffRails/Episode7/pull/12/files#r9718757).
>  
>  
>