TDD: Mocks and Messages

Readme Homework


TDD style message expectations; in both RSpec and MiniTest

Your Assignment

In most circumstances like this, there's a sort of MessageBoard. Let's create the idea of a MessageBoard class that both the engineer and the conductor know about.

  1. When the conductor sees trouble, the conductor tells the message_board to slow down
  2. When the engineer slows down, the engineer tells the message_board confirm_slow_down

Use whichever mocking tool you liked the best or are interested in. If you don't know what to choose, go with RSpec.

Copyright: Jesse Wolgamott, MIT License (See LICENSE)

TDD: Mocks and Messages

  • Area:

  • Runtime:

  • Tech:

    MiniTest & RSpec  
  • Tags:

    MiniTest mocks rspec  

Learn about Mocks and how they are similar to a phone tap -- we use TDD with MiniTest mocks to build a design for communication between an engineer and a conductor on a train.

We then show RSpec mocks, and how to use RSpec mocks in a MiniTest. Finally: a warning on too many mocks.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.


Ruby Off Rails is dedicated to accelerating the mastering of Ruby and increasing developer happiness everywhere.

In my software training, I see two distinct sets of programmers: those who know Ruby, and those who haven’t learned it yet. People who learn Ruby have an easier time understanding Rails, gems, and what magic voodoo is going on. And most importantly, they can cast wicked voodoo themselves.