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

How to run all tests with minitest?

Here’s a link to Rake::TestTask. There is an example in the page to get you started. I’ll post another one that I’m using right now for a gem: require ‘rake/testtask’ Rake::TestTask.new do |t| t.pattern = “spec/*_spec.rb” end As you can see, I assume that my files are all in /lib and that my specs are … Read more