P
Phil Tomson
Is there a way to initialize a unit test once and only once? I know that
you can define a #setup method, but it gets run for every test_* method in
the class.
I know I could do:
class TestStuff < Test::Unit::TestCase
def setup
unless @setup
@setup = true
#do stuff here only once
end
#do stuff out here for every test_* method
end
def test_foo
#setup will be called first
#test stuff
end
def test_foo_two
#setup will be called first
#test stuff
end
end
....but I'm wondering if there's a built-in way of doing this sort of
initialization already?
Phil
you can define a #setup method, but it gets run for every test_* method in
the class.
I know I could do:
class TestStuff < Test::Unit::TestCase
def setup
unless @setup
@setup = true
#do stuff here only once
end
#do stuff out here for every test_* method
end
def test_foo
#setup will be called first
#test stuff
end
def test_foo_two
#setup will be called first
#test stuff
end
end
....but I'm wondering if there's a built-in way of doing this sort of
initialization already?
Phil