"Testing. Why so serious?"
summary
Argues that using test doubles and RSpec features like instance_double cuts suite time from ~15 minutes to ~1 minute for ~4,000 specs by stubbing external calls (ActiveRecord find/update/destroy, Pusher notify) and testing service objects’ behavior instead of data flow. Presents four concrete rules: mock roles not objects, mock your own API, avoid mocking peers or internals, and measure which method calls are actually slow. Shows examples of brittle mocks (replacing find with where breaks tests) and working replacements that keep tests fast and flexible.
AI-written summary · about
chapters (15)
- 0:00Introduction
- 0:22Doubles in testing
- 1:57Sociable vs solitary tests
- 3:25Mocks and magic
- 4:10Common mocking problems
- 7:35Mock roles not objects
- 10:27Mock your own API
- 12:38Mock peers not internals
- 13:21Why mocks can be slow
- 14:04Testing with real data
- 19:41When to mock database calls
- 25:00Classic testing vs mocking
- 26:28Speed vs comfort in tests
- 27:35Handling external data flows
- 28:44Further resources








