Loading…
0+ curated questions with the same answer shape every time: quick recap, deep dive, pitfalls, and follow-ups. Coverage includes .
Test doubles, mocking, and contract testing are tested in every senior Rails interview that covers testing strategy. This module covers RSpec doubles (double vs instance_double vs class_double — verifying doubles catch interface drift), allow vs expect (stub vs mock distinction), stub_const for constant replacement, WebMock stub_request for HTTP call stubs (and why you must test the request shape, not just stub it away), VCR cassettes for recording/replaying external API calls (and the cassette staleness problem), the spy pattern for after-the-fact assertions, as_null_object for lenient doubles, the test isolation vs integration pyramid decision, Pact contract testing for Rails microservices (consumer-driven contracts), and the Ruby-specific depth marker: never mock what you don't own.
Full catalog
Topics are ordered for learning. Within each topic, rows are numbered 1–0 globally so you always know where you are. Collapse topics if you want a lighter view — use Expand all when you need the full list again.
Numbers 1–0 follow the order we recommend — click any row to open the full answer, or use the sticky Next link at the bottom of each page to go Q1 → Q0.