# Class: Mocha::ExpectationErrorFactory

Inherits:
  Object
  - Object
  - Mocha::ExpectationErrorFactory
  show all

Defined in:
  lib/mocha/expectation_error_factory.rb

## Overview

This factory determines what class of exception should be raised when Mocha detects a test failure.

This class should only be used by authors of test libraries and not by typical “users” of Mocha.

For example, it is used by `Mocha::Integration::Minitest::Adapter` in order to have Mocha raise a `Minitest::Assertion` which can then be sensibly handled by `Minitest::Unit::TestCase`.

See Also:

- Integration::Minitest::Adapter

## Class Attribute Summary collapse

- .exception_class ⇒ Exception

  Determines what class of exception should be raised when Mocha detects a test failure.

## Class Attribute Details

### .exception_class ⇒ `Exception`

Determines what class of exception should be raised when Mocha detects a test failure.

This attribute may be set by authors of test libraries in order to have Mocha raise exceptions of a specific class when there is an unexpected invocation or an unsatisfied expectation.

By default a `Mocha::ExpectationError` will be raised.

Returns:

- (`Exception`) —

  class of exception to be raised when an expectation error occurs

See Also:

- Mocha::ExpectationError

    25
    26
    27

    # File 'lib/mocha/expectation_error_factory.rb', line 25

    def exception_class
      @exception_class
    end