Stub HTTP requests in Rspec

In rspec, we need to make http call for our test to pass. In this case, we are actually making http request which is not a best practice while we are executing tests. The best way is to fake http request with the actual expected response without making actually going to that url. For faking http request in ruby, we have couple of gems namely FakeWeb and WebMock. FakeWeb: Usage: Include 'fakeweb' in your Gemfile under test group only. require it in spec helper. use it in specs Syntax: FakeWeb.register_uri(method, url, :body => "response text, html,