ExStub v0.2.0 ExStub.Assert
This module provides the assert_called
that can be used to assert functions calls on your stubs.
This module is already required and imported when using use ExStub
Summary
Functions
Asserts that the function was called on the module with the passed params
Functions
Asserts that the function was called on the module with the passed params.
The syntax is assert_called ModuleName.function_name(params)
assert_called ModuleName.function_name()
assert_called ModuleName.function_name(nil)
assert_called ModuleName.function_name(1, 2)
Example
defstub MyStub, for: OriginalModule do
def process(1), do: :stubbed3
end
MyStub.process(1)
# Passes since we called the function with [1]
MyStub.process(1)
# Fails since the parameters dont match
MyStub.process(1, 2)
# Fails since we did not call `another_method`
MyStub.another_method()