Skip to content

Instantly share code, notes, and snippets.

@barinek
Created March 20, 2010 14:36
Show Gist options
  • Save barinek/338700 to your computer and use it in GitHub Desktop.
Save barinek/338700 to your computer and use it in GitHub Desktop.
Net::HTTP Mock
http_mock = mock('Net::HTTPResponse')
http_mock.stubs(:code => '200', :body => 'response body', :message => 'response message')
Net::HTTP::Post.any_instance.expects(:body=).with("post body").once
Net::HTTP.any_instance.expects(:request).with(anything).once.returns(http_mock)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment