module MiniTest::Unit::Deprecated::Hooks
def self.add_setup_hook arg=nil, &block
def self.add_setup_hook arg=nil, &block warn "NOTE: MiniTest::Unit::TestCase.add_setup_hook is deprecated, use before/after_setup via a module (and call super!). It will be removed on 2013-01-01. Called from #{caller.first}" hook = arg || block @setup_hooks << hook end
def self.add_teardown_hook arg=nil, &block
def self.add_teardown_hook arg=nil, &block warn "NOTE: MiniTest::Unit::TestCase#add_teardown_hook is deprecated, use before/after_teardown. It will be removed on 2013-01-01. Called from #{caller.first}" hook = arg || block @teardown_hooks << hook end
def self.setup_hooks # :nodoc:
def self.setup_hooks # :nodoc: if superclass.respond_to? :setup_hooks then superclass.setup_hooks else [] end + @setup_hooks end
def self.teardown_hooks # :nodoc:
def self.teardown_hooks # :nodoc: if superclass.respond_to? :teardown_hooks then superclass.teardown_hooks else [] end + @teardown_hooks end
def _run_hooks hooks # :nodoc:
def _run_hooks hooks # :nodoc: hooks.each do |hook| if hook.respond_to?(:arity) && hook.arity == 1 hook.call(self) else hook.call end end end
def run_setup_hooks # :nodoc:
def run_setup_hooks # :nodoc: _run_hooks self.class.setup_hooks end
def run_teardown_hooks # :nodoc:
def run_teardown_hooks # :nodoc: _run_hooks self.class.teardown_hooks.reverse end