---
title: "Reliving Your Happiest HTTP Interactions with Ruby’s VCR Gem"
description: "VCR records live HTTP interactions into YAML \"cassettes\" and replays them in Ruby tests, giving accurate fixtures for complex, slow, or poorly understood APIs where hand-built Webmock stubs drift from real behavior."
url: "https://swe.quest/articles/reliving-your-happiest-http-interactions-with-ruby-s-vcr-gem-875b5fd62be42b02"
canonical: "https://shopify.engineering/how-to-program-your-vcr"
source: "Shopify Engineering"
published: "2023-01-05"
difficulty: "medium"
kind: "How-to"
reading_minutes: 8
tags: ["ruby","testing"]
---

# Reliving Your Happiest HTTP Interactions with Ruby’s VCR Gem

A post on [Shopify Engineering](https://swe.quest/sources/shopify.md), published 2023-01-05, 8 min read, How-to. Original: [https://shopify.engineering/how-to-program-your-vcr](https://shopify.engineering/how-to-program-your-vcr)

## Summary

VCR records live HTTP interactions into YAML "cassettes" and replays them in Ruby tests, giving accurate fixtures for complex, slow, or poorly understood APIs where hand-built Webmock stubs drift from real behavior. Use VCR for multi-call integration tests and unpredictable APIs, and keep Webmock or decomposed unit tests for simple, well-understood calls or state that is hard to reproduce. Practical advice includes avoiding the default :new\_episodes record mode in favor of :once or :none, logging requests with before filters, scrubbing secrets with filter\_sensitive\_data, isolating erratic auth calls into their own cassettes, and deleting cassettes liberally.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Ruby](https://swe.quest/tags/ruby.md) (Languages)
- [Testing](https://swe.quest/tags/testing.md) (Engineering practices)

## Prerequisites

- Ruby testing basics ([easy posts on Ruby](https://swe.quest/tags/ruby.md?difficulty=easy))
- HTTP APIs ([easy posts on API design](https://swe.quest/tags/api-design.md?difficulty=easy))
- test stubs and mocks

## Keywords

VCR, Webmock, Net::HTTP

## Related posts

- [Deterministic AI Testing with Session Recording in cagent](https://swe.quest/articles/deterministic-ai-testing-with-session-recording-in-cagent-aad4a70e828b2b3b.md): Docker · 2026-01-06 · Medium · 2 min read · AI agents, Testing, CI/CD
  cagent's session recording applies the VCR pattern to AI agents.
- [Enhancing the Mock Server: A User Interface Approach](https://swe.quest/articles/enhancing-the-mock-server-a-user-interface-approach-ff47adf3053feadf.md): Zalando Engineering · 2024-04-24 · Medium · 7 min read · Frontend, React, Testing, Developer productivity
  Zalando's team built a UI on top of mirage.js so product managers and designers can switch which mocked response each API endpoint returns on a staging build, without code changes or redeploys.
- [Modular regression testing framework built on AWS for large-scale systems](https://swe.quest/articles/modular-regression-testing-framework-built-on-aws-for-large-scale-systems-5423a76854a0e19b.md): AWS Architecture Blog · 2026-11-12 · Medium · 14 min read · Testing, Deployment, CI/CD, Serverless, Cloud platforms
  A traffic-replay regression testing framework built on AWS captures production requests and responses, replays a sample against new code in pre-production, and gates deployments on a CloudWatch alarm over the fraction of matching outputs (typically 99.9%).
- [Introducing eve 1.0](https://swe.quest/articles/introducing-eve-1-0-4e45195b6c9ddca5.md): Vercel · 2026-11-17 · Easy · 7 min read · AI agents, Observability, Performance engineering, Multi-tenancy, Open source
  eve 1.0, Vercel's open-source framework for production agents, is now generally available with a customizable harness (model, tools, subagents, approvals), durable execution via the Workflow SDK, multiplayer sessions across Slack and other channels, multi-tenant credentials and policies, cross-session memory, and OpenTelemetry-based tracing with per-destination redaction.
- [Workflow SDK 5: built for production](https://swe.quest/articles/workflow-sdk-5-built-for-production-8a4967cc859bc936.md): Vercel · 2026-11-12 · Medium · 9 min read · Serverless, Resilience, Performance engineering, Cryptography, AI agents
  Workflow SDK 5 reworks Vercel's durable async JavaScript workflow engine around security, regional placement and performance.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
