First, let’s talk about the different usage modes of test doubles.
RSpec’s double method creates a generic test double that you can use in any mode. The simplest way to call this method is with no arguments. Let’s try that now:
|||>> ledger = double|
|||=> #<Double (anonymous)>|
In some ways, this double acts like an ordinary Ruby object. As you send messages to it (in other words, call methods on it), it will accept some messages and reject others.
The difference is that a generic double gives you more debugging information than a regular Ruby object. Try sending the record message to your test double now:
|||>> ledger.record(an: :expense)|
|||RSpec::Mocks::MockExpectationError: #<Double ...|