Class: Mocha::ExceptionRaiser

Inherits:
Object
  • Object
show all
Defined in:
lib/mocha/exception_raiser.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(exception, message) ⇒ ExceptionRaiser

Returns a new instance of ExceptionRaiser.



5
6
7
# File 'lib/mocha/exception_raiser.rb', line 5

def initialize(exception, message)
  @exception, @message = exception, message
end

Instance Method Details

#evaluateObject

Raises:

  • (@exception)


9
10
11
12
13
# File 'lib/mocha/exception_raiser.rb', line 9

def evaluate
  raise @exception, @exception.to_s if @exception.is_a?(Module) && @exception.ancestors.include?(Interrupt)
  raise @exception, @message if @message
  raise @exception
end