Mid-level Track Roadmap

Integrations: WebMock/VCR

This course covers how a Rails application tests its outbound integrations without touching the network. It starts from the four integrations in one repository: site icon fetching, partner webhooks, GitHub OAuth and mail. It compares four places to cut the wire: an injected fake, a library's test mode, WebMock and VCR cassettes. It then covers WebMock stubs and request assertions, VCR record modes and secret filtering, drift between stubs and real services, stubbing many integrations, and a concrete plan for this app.

What you'll learn

  • ✓Why real network calls make a test suite flaky, slow, unrepeatable and side-effecting
  • ✓How to choose between an injected fake, a library test mode, WebMock and VCR
  • ✓Using disable_net_connect!, stub_request, failure stubs and have_requested in WebMock
  • ✓Configuring VCR record modes, request matching and filter_sensitive_data
  • ✓Mitigating drift between stubs and the real service
  • ✓Organizing stubs, failure cases and cassettes across many integrations
Free preview · Lesson 1 4 min read

The only HTTP this app makes

Before learning tools for stubbing outbound HTTP, it is worth knowing how much outbound HTTP there is. In this repository, a search for every HTTP client returns two files.

Read the full lesson free →

Curriculum

7 lessons
Type to start searching...