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.



2391
2392
2393
# File 'lib/test/unit/assertions.rb', line 2391

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



2410
2411
2412
# File 'lib/test/unit/assertions.rb', line 2410

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

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



2390
2391
2392
# File 'lib/test/unit/assertions.rb', line 2390

def exception
  @exception
end

Instance Method Details

#inspectObject



2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
# File 'lib/test/unit/assertions.rb', line 2395

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