I do the following:
class FakeResponse
def body
'access_token=token'
end
end
Net::HTTP.stub(:get_response).and_return(FakeResponse.new)
This works fine, but I want as well test, what's the requested URL. So I do
url = 'http://google.de'
Net::HTTP.stub(:get_response).with(URI.parse(url)).and_return(FakeResponse.new)
This does not really work, as it's not the same instance of URI. And in fact, I'd just like to test against an instance variable of that URI.
Is there some way to invoke a block or something to do this test with less pain?