Module: Test::Unit::ExceptionHandler

Included in:
TestCase
Defined in:
lib/test/unit/exceptionhandler.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

@@exception_handlers =
[]

Class Method Summary collapse

Class Method Details

.exception_handlersObject



6
7
8
# File 'lib/test/unit/exceptionhandler.rb', line 6

def exception_handlers
         @@exception_handlers
end

.included(base) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/test/unit/exceptionhandler.rb', line 10

def included(base)
  base.extend(ClassMethods)

  observer = Proc.new do |test_case, _, _, value, method_name|
    if value
      @@exception_handlers.unshift(method_name)
    else
      @@exception_handlers -= [method_name]
    end
  end
  base.register_attribute_observer(:exception_handler, &observer)
end