Class: Test::Unit::Assertions::AssertExceptionHelper::WrappedException

Inherits:
Object
  • Object
show all
Defined in:
lib/test/unit/assertions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exception) ⇒ WrappedException

Returns a new instance of WrappedException.



2304
2305
2306
# File 'lib/test/unit/assertions.rb', line 2304

def initialize(exception)
  @exception = exception
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



2323
2324
2325
# File 'lib/test/unit/assertions.rb', line 2323

def method_missing(name, *args, &block)
  @exception.__send__(name, *args, &block)
end

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



2303
2304
2305
# File 'lib/test/unit/assertions.rb', line 2303

def exception
  @exception
end

Instance Method Details

#inspectObject



2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
# File 'lib/test/unit/assertions.rb', line 2308

def inspect
  if default_inspect?
    inspected = "#{@exception.class.inspect}(<#{@exception.message}>)"
    unless (@exception.backtrace || []).empty?
      inspected += "\n"
      @exception.backtrace.each do |trace|
        inspected << "#{trace}\n"
      end
    end
    inspected
  else
    @exception.inspect
  end
end