Pavlov.Mocks.Matchers

Provides matchers for Mocked modules.

Source

Summary

called(arg1)

Asserts whether a method was called when using “Asserts” syntax:

to_have_received(module, tuple)

Asserts whether a method was called with on a mocked module. Use in conjunction with with to perform assertions on the arguments passed in to the method

with(method, args)

Use in conjunction with to_have_received to perform assertions on the arguments passed in to the given method

Functions

to_have_received(module, tuple)

Asserts whether a method was called with on a mocked module. Use in conjunction with with to perform assertions on the arguments passed in to the method.

A negative version not_to_have_received is also provided. The same usage instructions apply.

Example

expect HTTPotion |> to_have_received :get
Source
with(method, args)

Use in conjunction with to_have_received to perform assertions on the arguments passed in to the given method.

Example

expect HTTPotion |> to_have_received :get |> with "http://example.com"
Source

Macros

called(arg1)

Asserts whether a method was called when using “Asserts” syntax:

Example

assert called HTTPotion.get("http://example.com")
Source