A presentation at RubyConf Mini in in Providence, RI, USA by Vladimir Dementyev
To mock or not mock is an important question, but let’s leave it apart and admit that we, Rubyists, use mocks in our tests.
Mocking is a powerful technique, but even when used responsibly, it could lead to false positives in our tests (thus, bugs leaking to production): fake objects could diverge from their real counterparts.
In this talk, I’d like to discuss various approaches to keeping mocks in line with the actual implementation and present a brand new idea based on mock fixtures and contracts.
The following resources were mentioned during the presentation or are useful additional information.
This issue reveals the story behind verified doubles in RSpec
Under the hood of RSpec verified doubles
Mocking library for Ruby with contracts support
Experimental contract-based mockist testing library
Here’s what was said about this presentation on Twitter.