Shopify

Reliving Your Happiest HTTP Interactions with Ruby’s VCR Gem - Shopify

Jan 5, 2023
Reliving Your Happiest HTTP Interactions with Ruby’s VCR Gem - Shopify
SummaryAI, from the source post

This post details the use of the VCR gem for recording and playing back HTTP interactions in Ruby applications. It explains the differences between VCR and Webmock, highlighting VCR's strengths for integration tests with complex or unpredictable APIs. It provides guidance on when to use VCR, when it's overkill, and how to mix it with other mocking strategies. Practical usage instructions are given, including configuration, working against live APIs, avoiding `:new_episodes`, using `before_filter` for logging, and `filter_sensitive_data` for sensitive information. Advanced techniques like splitting collaborators and inspecting YAML files are also discussed.