Fake It While You Make It
summary
Builds SWEATHR on a real weather API then walks four concrete approaches: live requests (slow, flaky), Webmock stubs (fast but brittle), a Sinatra fake web app with Capybara Discoball (full‑stack but extra maintenance), and VCR cassettes (record once, replay until stale). Recommends layering: an API client, a CurrentConditions mapper, and a weather module with a test‑mode fake client. Demonstrates each tool, shows tradeoffs, and notes tests often cost more time than the implementation.
AI-written summary · about
chapters (15)
- 0:00Introduction
- 3:45Sweater Weather
- 5:45Dependency
- 7:15Model Tests
- 8:25Web Mock
- 10:35Stubbing
- 14:40Using Fakes
- 16:05Using Fixtures
- 21:30Review
- 24:50Current Conditions
- 26:40Weather Module
- 27:20Example
- 29:10Test Mode
- 30:40Test Mode Benefits
- 33:10Conclusion
related talks
26mTesting HTTP APIs with Ruby
31mThe power of mocking APIs
42mFree Your Frontend Client from Backend Cage
28mTesting HTTP APIs in Ruby
20mGo Find What We May Have Missed!
27mEffectively Testing Services
35mFake It Before You Make It: Mocking Your Way to Better HTTP APIs
30mFaking It - The Art of Testing Using Verified Fakes
