Nathaniel Talbott
7/9/2005 3:06:00 PM
On Jun 10, 2005, at 13:50 , Michael Schuerig wrote:
> Is there a way to wrap setup and teardown methods around an entire
> suite? I haven't seen explicit methods for this purpose, but maybe
> there's an idiomatic way to achieve the same result.
This is late, but here's something that will work:
require 'test/unit'
class T < Test::Unit::TestCase
def setup
p 'setup'
end
def teardown
p 'teardown'
end
def test1
p 'test1'
end
def test2
p 'test2'
end
def self.suite
s = super
def s.setup
p 'suite_setup'
end
def s.teardown
p 'suite_teardown'
end
def s.run(*args)
setup
super
teardown
end
s
end
end
I do plan on providing a better way to do that, but for now we can
just lean on the extreme flexibility of Ruby.
HTH,
--
Nathaniel Talbott
<:((><