123456789_123456789_123456789_123456789_123456789_

Module: Test::Unit::ErrorHandler

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/test/unit/error.rb

Constant Summary

Class Method Summary

Instance Method Summary

Class Method Details

.included(base)

[ GitHub ]

  
# File 'lib/test/unit/error.rb', line 74

def included(base)
  base.exception_handler(:handle_all_exception)
end

Instance Method Details

#add_error(exception) (private)

[ GitHub ]

  
# File 'lib/test/unit/error.rb', line 115

def add_error(exception)
  error = Error.new(name, exception, :method_name => @method_name)
  current_result.add_error(error)
end

#handle_all_exception(exception) (private)

[ GitHub ]

  
# File 'lib/test/unit/error.rb', line 85

def handle_all_exception(exception)
  return false if pass_through_exception?(exception)

  problem_occurred
  add_error(exception)
  true
end

#pass_through_exception?(exception) ⇒ Boolean (private)

[ GitHub ]

  
# File 'lib/test/unit/error.rb', line 93

def pass_through_exception?(exception)
  case exception
  when *NOT_PASS_THROUGH_EXCEPTIONS
    return false
  end
  case exception.class.name
  when *NOT_PASS_THROUGH_EXCEPTION_NAMES
    return false
  end

  case exception
  when *PASS_THROUGH_EXCEPTIONS
    return true
  end
  case exception.class.name
  when *PASS_THROUGH_EXCEPTION_NAMES
    return true
  end

  false
end