Skip to content

Instantly share code, notes, and snippets.

@jugyo
Created February 20, 2012 15:06
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jugyo/1869594 to your computer and use it in GitHub Desktop.
Save jugyo/1869594 to your computer and use it in GitHub Desktop.
webmock + sinatra
require 'webmock'
require 'sinatra/base'
WebMock::API.stub_request(:any, /www\.example\.com/).to_rack(Class.new(Sinatra::Base) {
post "/foo" do
"FOO"
end
})
require 'httpclient'
res = HTTPClient.new.post_content("http://www.example.com/foo")
p res
#=> "FOO"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment