I am new to minitest and still new to ruby ββand am very tired of trying to resolve this issue to no avail. I would be very grateful for the help:
What is the exact syntax of assert_output in minitest ruby?
Everything I find on github or elsewhere seems to use parentheses. However, I get an error when I do not use a block with assert_output, which makes sense because the definition of this method contains a yield statement.
But I can't get it to work, no matter what I try.
testclass.rb
class TestClass def output puts 'hey' end end
test_test.rb
require 'minitest/spec' require 'minitest/autorun' require_relative 'testclass' class TestTestClass < MiniTest::Unit::TestCase def setup @test = TestClass.new end def output_produces_output assert_output( stdout = 'hey' ) { @test.output} end end
I get:
Ready tests in 0.000000s, NaN / s tests, NaN statements
0 tests, 0 statements, 0 errors, 0 errors, 0 omissions
What am I doing wrong? It should be something completely obvious, but I can't figure it out. Thank you for your help.
source share