ESpec v1.6.0 ESpec.Mock View Source

Defines ‘expect` function to mock function using ‘meck’. :meck.new is called with options :non_strict and :passthrough. The :non_strict allows create mocks for modules and functions that do not exist. The :passthrough options allow call other functions in the module. Information about mock is stored in the ‘:espec_mock_agent’ set. Mock are being unloaded after each example.

Link to this section Summary

Functions

Creates new mock using :meck. The default :meck options are [:non_strict, :passthrough] but they can be overriden. Stores mock in agent to remove it after spec

Starts Agent to save mocked modules

Stops Agent

Unloads modules at the end of example

Link to this section Functions

Link to this function expect(module, name, function, meck_options) View Source

Creates new mock using :meck. The default :meck options are [:non_strict, :passthrough] but they can be overriden. Stores mock in agent to remove it after spec.

Starts Agent to save mocked modules.

Stops Agent

Unloads modules at the end of example