How to assert certain method is called with Ruby minitest framework?
I want to test whether a function invokes other functions properly with minitest Ruby, but I cannot find a proper assert to test from the doc . The source code class SomeClass def invoke_function(name) name == "right" ? right () : wrong () end def right #... end def wrong #... end end The test code: describe SomeClass do it "should invoke right function" do # assert right() is called end it "should invoke other function" do # assert wrong() is called end end With minitest you use expect method to set the expectation for a method to be called on a mock object like so obj = MiniTest::Mock.new