I need to have a setup and teardown method for some Rails tests that is class or system wide, yet I have only found a way to define a regular setup/teardown that works on a per test level.
For example:
class ActiveSupport::TestCase
setup do
puts "Setting up"
end
teardown do
puts "tearing down"
end
end
will execute the outputs for each test case, but I would like something like:
class ActiveSupport::TestCase
setup_fixture do
puts "Setting up"
end
teardown_fixture do
puts "tearing down"
end
end
which would execute the setup_
fixture before all test methods, and then execute teardown_
fixture after all test methods.
Is there any such mechanism? If not, is there an easy way to monkey patch this mechanism in?