Sha256: 3ac455577c52f0cbc8a69fd4f33889c7c784a38fc2d4ad5021717ad6ad01fe8e
Contents?: true
Size: 975 Bytes
Versions: 170
Compression:
Stored size: 975 Bytes
Contents
module Test module Unit module ExceptionHandler @@exception_handlers = [] class << self def exception_handlers @@exception_handlers end 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 end module ClassMethods def exception_handlers ExceptionHandler.exception_handlers end def exception_handler(*method_names) attribute(:exception_handler, true, *method_names) end def unregister_exception_handler(*method_names) attribute(:exception_handler, false, *method_names) end end end end end
Version data entries
170 entries across 154 versions & 14 rubygems