How do I stub things in MiniTest?

# Create a mock object book = MiniTest::Mock.new # Set the mock to expect :title, return “War and Piece” # (note that unless we call book.verify, minitest will # not check that :title was called) book.expect :title, “War and Piece” # Stub Book.new to return the mock object # (only within the scope of the … Read more

What’s the difference between a mock & stub?

Foreword There are several definitions of objects, that are not real. The general term is test double. This term encompasses: dummy, fake, stub, mock. Reference According to Martin Fowler’s article: Dummy objects are passed around but never actually used. Usually they are just used to fill parameter lists. Fake objects actually have working implementations, but … Read more