Keploy as a Ruby on Rails testing framework
Keploy tests Rails applications by recording real requests through the running server and every ActiveRecord query or outbound call they trigger, then replaying both as assertions. No test schema is loaded, because replay never opens a database connection.
keploy record -c "bundle exec rails server -p 3000"What Keploy gives a Ruby on Rails team
Any Rails app, unchanged
Keploy runs the app through rails server or Puma. Rack middleware, strong parameters, ActiveRecord callbacks, and serializers all execute because capture happens at the socket.
- Rails 6.1 and above
- rails server, Puma, or Passenger
- API-only and full-stack apps
- Initializers run for real
Why Ruby on Rails integration tests slow teams down
The friction is rarely the assertions. It is everything around them — spinning up dependencies, keeping mocks honest, and repairing tests after every refactor.
Testing Ruby on Rails: by hand, with RSpec request specs + VCR, or with Keploy
Request specs need a migrated test database and cassettes that freeze on the day they are cut. Keploy records both the SQL and the HTTP together, and refreshes them in one pass.
Select any row for the full comparison, with code.
What you write for Ruby on Rails vs what Keploy records
All three produce the same assertion. Only the third still passes after the next refactor without anyone editing it.
Two stubbed class methods and a private method called directly. Routing, strong parameters, and the before_action that authorises this never run.
Drives the whole stack, which is the right idea — and it needs a migrated database, a factory, and a cassette that ages out of date on its own.
The SQL and the Stripe response are recorded together, so one re-record refreshes both — rather than a cassette per exchange going stale independently.
Times are estimates for authoring one endpoint’s coverage from scratch, not measurements.
Ruby on Rails testing tools, compared
The options a team on Ruby actually reaches for, and where each one genuinely wins. Select a row for the full comparison.
Assessments reflect each tool’s documented behaviour, not benchmark measurements.
Record your Ruby on Rails app once, replay it forever
Keploy sits below your Ruby on Rails process at the network layer. It watches the calls your app already makes, then serves them back on replay so tests run with no dependencies attached.
Keploy records a GET call to /api/v1/orders/{id} on a Ruby on Rails service and captures the dependency calls it makes.
What Keploy mocks for Ruby on Rails, with zero config
6 of the 6 dependencies a typical Ruby on Rails service talks to are stubbed from the recording itself — no mock classes, no fixture files, no containers in CI.
- Auto-mocked
PostgreSQLView page
Postgres protocol under the pg adapter
- Auto-mocked
MySQLView page
MySQL protocol under mysql2
- Auto-mocked
RedisView page
RESP under redis-rb and Rails cache
- Auto-mocked
SidekiqView page
Job pushes as the Redis commands they really are
- Auto-mocked
MongoDBView page
Wire protocol under Mongoid
- Outbound HTTPAuto-mocked
Outbound HTTP
Any Net::HTTP, Faraday, or HTTParty call
Your first Ruby on Rails test suite in under five minutes
Every command below runs against your existing Ruby on Rails service. Nothing in your source tree changes.
1Install the Keploy CLI
A single binary. It needs a Linux kernel with eBPF support, or Docker on macOS and Windows — and it adds nothing to your project's dependencies.
curl -sSL https://keploy.io/install.sh | bash2Record your service
Pass the command you already use to start the app. Keploy runs it and watches every socket it opens.
keploy record -c "bundle exec rails server -p 3000"3Exercise the paths you care about
Drive the running server. Every request becomes a test case with its ActiveRecord queries and outbound HTTP captured alongside.
curl -X POST localhost:3000/orders/ord_1/confirm -H 'Content-Type: application/json' -H 'Authorization: Bearer $TOKEN' -d '{"payment_token":"tok_123"}'4Replay in CI
Replay serves the recorded dependency responses, so the job needs no service containers and no Docker daemon.
keploy test -c "bundle exec rails server -p 3000" --delay 14
Ready to try it on your own Ruby on Rails service?
Works with the rest of your Ruby on Rails stack
Keploy records at the network layer, so framework and driver choices inside your Ruby on Rails app do not change how it captures traffic.
Ruby
The language page covers driver-level coverage in depth.
ActiveRecord
Queries record as the SQL they generate, with real rows.
PostgreSQL
The database page covers protocol-level capture in depth.
Sidekiq
Job pushes appear as the Redis exchanges they are.
Puma
Record through Puma to exercise the production server path.
Docker
Record in a container or on the host; replay needs neither.
Testing the rest of your stack
- Languages
Keploy as a Ruby testing framework
Replace WebMock stubs and VCR cassettes with tests recorded from the traffic your Ruby app already serves.
Read the guide - Databases
Keploy as a PostgreSQL testing framework
Record the Postgres frontend/backend protocol once and replay real result sets in tests — no container, no pg-mem, no schema to rebuild.
Read the guide - Caches & Stores
Keploy as a Redis testing framework
Record RESP traffic once and replay real cache hits, misses, TTLs, and pipeline responses without a Redis server in CI.
Read the guide - Databases
Keploy as a MySQL testing framework
Mock MySQL at the wire protocol instead of standing up a container or swapping in H2 — the rows your queries really returned, replayed.
Read the guide - Databases
Keploy as a MongoDB testing framework
Mock MongoDB at the wire protocol — real documents, real BSON types, real aggregation results — without a mongod binary in CI.
Read the guide
Join our GlobalCommunity
Connect with developers worldwide. Follow updates, ask questions, share feedback, and ship faster with other Keploy builders.
“Best report of integration and API tests I've seen — which we don't get from RestAssured.”
G2“Future of microservices testing. I don't write tests now!”
G2 · 5/5“An amazing product that simplifies the automation.”
Gartner · 4.0