rspec/rspec-mocks — Issue #85: any_instance.stub(:foo).and_bar on private methods
Author: RobertLowe
Created: 2011-10-14 20:47:40+00:00
State: open

any_instance.stub(:foo) seems to undefine private methods

I was stubbing out ActiveResource::Connection.request to raise an error for some controller test

it "with a timeout" do
ActiveResource::Connection.any_instance.stub(:request).and_raise(ActiveResource::TimeoutError.new("call the police"))
post :create, :uuid => "foobar"

# some assert
end

# this would pass but then next test to invoke will raise

NoMethodError:
undefined method `request' for #