E
Eric Boucher
Hi,
I want to be able to unit/test an output with the method 'puts'. Here's
a small example of what I'm trying to achieve:
#-------8<--------
class Foo
def output
puts "bar"
end
end
#-------8<--------
...and in my test
#-------8<--------
require 'unit/test'
...
def test_output
myFoo = Foo.new
assert_equal("bar", myFoo.output)
end
#-------8<--------
The problem is that the 'puts' method returns nil and I don't know how
to catch the output.
Thanks in advance.
I want to be able to unit/test an output with the method 'puts'. Here's
a small example of what I'm trying to achieve:
#-------8<--------
class Foo
def output
puts "bar"
end
end
#-------8<--------
...and in my test
#-------8<--------
require 'unit/test'
...
def test_output
myFoo = Foo.new
assert_equal("bar", myFoo.output)
end
#-------8<--------
The problem is that the 'puts' method returns nil and I don't know how
to catch the output.
Thanks in advance.