To Mock or Not to Mock
summary
Argues that mock use must match the test’s goal and gives concrete measures: ActiveRecord base exposes 301 public methods so isolation is hard, end-to-end tests prove safety at high cost, and isolation TDD (the Goose approach) yields tiny fast suites—he cites 3–4k specs in under 3–4 seconds. Recommends four strategies (maximize realism, mock boundaries, case-by-case, grow OO), warns Rails forces tradeoffs, and notes a homegrown test-double library gimme and the company TestDouble.
AI-written summary · about
chapters (17)
- 0:00Start
- 1:18Maximally Realistic Test
- 5:29Avoid over Mocking
- 6:12Types of Tests
- 6:26End-to-End Test
- 6:44End-to-End Tests
- 6:58Dog Feeder Class
- 10:48Roll Your Own Stubs
- 11:10Example for Mocha
- 13:23Motivations for Tests Acceptance
- 14:27Regression
- 15:01Test Driven Design
- 17:54Slow Feedback
- 18:28Mocking Boundaries
- 21:36Developer Freedom
- 31:14Inherited Surface Area
- 35:27Testable Libraries for Ruby








