finds.dev← search

// the find

wycats/artifice

★ 211 · Ruby · MIT · updated May 2022

Replaces Net::HTTP with a subclass that routes all requests to a Rack application

Artifice monkey-patches Net::HTTP to route all outbound HTTP requests to a local Rack app instead of the network. It's a test helper for Ruby code that makes HTTP calls you want to intercept without spinning up a real server.

Works at the Net::HTTP level so it intercepts everything that goes through it, including gems that don't expose their HTTP client. Block form for scoped activation is clean — no setup/teardown ceremony. Lets you use Sinatra or Rails routing to build realistic mock endpoints rather than hand-rolling response strings.

Dead project — last commit 2022, 211 stars, 12 forks, no releases in years. Only intercepts Net::HTTP; anything using Faraday with a non-Net::HTTP adapter, HTTParty configured differently, or libcurl bindings will slip right through. WebMock and VCR have largely superseded this with broader adapter support and more control. No thread-safety story for the global activation state.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →