Module: MiniTest::Unit::Deprecated::HooksCM

Included in:
TestCase
Defined in:
lib/minitest/unit.rb

Overview

This entire module is deprecated and slated for removal on 2013-01-01.

Instance Method Summary collapse

Instance Method Details

#add_setup_hook(arg = nil, &block) ⇒ Object

Adds a block of code that will be executed before every TestCase is run.

NOTE: This method is deprecated, use before/after_setup. It will be removed on 2013-01-01.



1187
1188
1189
1190
1191
# File 'lib/minitest/unit.rb', line 1187

def 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

#add_teardown_hook(arg = nil, &block) ⇒ Object

Adds a block of code that will be executed after every TestCase is run.

NOTE: This method is deprecated, use before/after_teardown. It will be removed on 2013-01-01.



1208
1209
1210
1211
1212
# File 'lib/minitest/unit.rb', line 1208

def 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

#setup_hooksObject

:nodoc:



1193
1194
1195
1196
1197
1198
1199
# File 'lib/minitest/unit.rb', line 1193

def setup_hooks # :nodoc:
  if superclass.respond_to? :setup_hooks then
    superclass.setup_hooks
  else
    []
  end + @setup_hooks
end

#teardown_hooksObject

:nodoc:



1214
1215
1216
1217
1218
1219
1220
# File 'lib/minitest/unit.rb', line 1214

def teardown_hooks # :nodoc:
  if superclass.respond_to? :teardown_hooks then
    superclass.teardown_hooks
  else
    []
  end + @teardown_hooks
end