Skip to content
Replaces Net::HTTP with a subclass that routes all requests to a Rack application http://www.yehudakatz.com
Ruby
Find file
Latest commit cc851e1 @indirect indirect Merge pull request #12 from shawndrost/streaming_requests
handle streaming requests
Failed to load latest commit information.
lib handle streaming requests
spec handle streaming requests
.gitignore Some infrastructure updates
Gemfile
Gemfile.lock updated gemfile so it can resolve dependencies again
LICENSE Initial commit of artifice with some tests.
README.textile Initial commit of artifice with some tests.
Rakefile
artifice.gemspec removed has_rdoc from gemspec so the deprecation warnings will go away

README.textile

Artifice allows you to replace the Net::HTTP subsystem of Ruby
with an equivalent that routes all requests to a Rack application.

You can use Sinatra, raw Rack, or even Rails as your application,
allowing you to build up an equivalent to the remote service you
are mocking out using familiar and convenient tools to route
requests and build up responses.

Usage

First, require artifice.

require "artifice"

Next, activate artifice using a Rack endpoint.

Artifice.activate_with(rack_endpoint)

You’re done!

You can also pass a block to activate_with:

Artifice.activate_with(rack_endpoint) do
  # make some requests using Net::HTTP
end

This will replace Net::HTTP for the duration of the block only.

You can deactivate Artifice by calling deactivate

Artifice.deactivate
Something went wrong with that request. Please try again.