title: Ruby minitest assert_output syntax
body: <p>I am new to minitest and still new to ruby and really tired of trying to google this question without result. I would be really grateful for help:</p>
  
  <p>What is the exact syntax of assert_output in ruby minitest?</p>
  
  <p>All I find on github or elsewhere seems to use parentheses. Yet, I get an error message when I don't use a block with assert_output, which makes sense as the definition of this method contains a yield statement. </p>
  
  <p>But I cannot make it work, whatever I try. </p>
  
  <p>testclass.rb</p>
  
  <pre><code>class TestClass
    def output
      puts 'hey'
    end
  end
  </code></pre>
  
  <p>test_test.rb</p>
  
  <pre><code>require 'minitest/spec'
  require 'minitest/autorun'
  require_relative 'testclass'
  
  
  class TestTestClass &lt; MiniTest::Unit::TestCase 
    def setup
      @test = TestClass.new
    end
  
    def output_produces_output
      assert_output( stdout = 'hey' ) { @test.output}
    end   
  end 
  </code></pre>
  
  <p>What I get is:</p>
  
  <p>Finished tests in 0.000000s, NaN tests/s, NaN assertions</p>
  
  <p>0 tests, 0 assertions, 0 failures, 0 errors, 0 skips</p>
  
  <p>What am I doing wrong? 
  It must be something totally obvious, but I cannot figure it out. 
  Thanks for your help. </p>