title: How to test if method gets called using MiniTest::Mock
body: <p>I would like to test if a method, in this case 'puts', gets called when I include the Foo module into a class and call 'bar'.</p>
  
  <pre><code>require 'minitest/autorun'
  
  module Foo
    def bar
      puts 'bar'
    end
  end
  
  class FooTest &lt; MiniTest::Unit::TestCase
    def setup
      @class = Class.new do
        extend Foo
      end
    end
  
    def test_if_bar_method_calls_puts
      mock = MiniTest::Mock.new
      mock.expect(:puts, nil, ['bar'])
      @class.bar
      assert mock.verify
    end
  end
  </code></pre>