Releases: edgurgel/mimic
Releases · edgurgel/mimic
Mimic 2.3.0
Immutable
release. Only release title and notes can be modified.
Mimic 2.2.0
Immutable
release. Only release title and notes can be modified.
Mimic 2.1.1
Mimic 2.1.0
What's Changed
- Usage rules by @pcharbon70 in #102
- fix: define replaced Elixir module macros using defmacro by @yastanotheruser in #104
New Contributors
- @pcharbon70 made their first contribution in #102
- @yastanotheruser made their first contribution in #104
Full Changelog: v2.0.2...v2.1.0
Mimic 2.0.2
What's Changed
- fix: Mimic.Module compilation when no options are stored by @edgurgel in #101 . Thanks to @nelsonmestevao for finding this issue 🎉
Full Changelog: v2.0.1...v2.0.2
Mimic 2.0.1
- Bump
hamrequirement
Full Changelog: v2.0.0...v2.0.1
Mimic 2.0.0
What's Changed
Breaking changes
The code below would call the original Calculator.add/2 when all expectations were fulfilled.
Calculator
|> expect(:add, fn _, _ -> :expected1 end)
|> expect(:add, fn _, _ -> :expected2 end)
assert Calculator.add(1, 1) == :expected1
assert Calculator.add(1, 1) == :expected2
assert Calculator.add(1, 1) == 2Now with Mimic 2 this will raise:
Calculator
|> expect(:add, fn _, _ -> :expected1 end)
|> expect(:add, fn _, _ -> :expected2 end)
assert Calculator.add(1, 1) == :expected1
assert Calculator.add(1, 1) == :expected2
Calculator.add(1, 1)
# Will raise error because more than 2 calls to Calculator.add were made and there is no stub
# ** (Mimic.UnexpectedCallError) Calculator.add/2 called in process #PID<.*> but expectations are already fulfilledIf there is a stub the stub will be called instead. This behaviour is the same as before.
Calculator
|> expect(:add, fn _, _ -> :expected1 end)
|> expect(:add, fn _, _ -> :expected2 end)
|> stub(:add, fn _, _ -> :stub end)
assert Calculator.add(1, 1) == :expected1
assert Calculator.add(1, 1) == :expected2
assert Calculator.add(1, 1) == :stubWhich means that if someone wants to keep the original behaviour on Mimic 1.* just do the following:
Calculator
|> expect(:add, fn _, _ -> :expected1 end)
|> expect(:add, fn _, _ -> :expected2 end)
|> stub(:add, fn x, y -> call_original(Calculator, :add, [x, y]) end)
assert Calculator.add(1, 1) == :expected1
assert Calculator.add(1, 1) == :expected2
assert Calculator.add(1, 1) == 2This way once all expectations are fulfilled the original function is called again.
Full Changelog: v1.12.0...v2.0.0
Mimic 1.12.0
What's Changed
- Mimic.calls/3 to list args from each call by @brentjanderson in #94
New Contributors
- @brentjanderson made their first contribution in #94
Full Changelog: v1.11.2...v1.12.0
Mimic 1.11.2
What's Changed
- don't soft reset if repeat_until_failure is 0 by @sgtpepper43 in #93
Full Changelog: v1.11.1...v1.11.2
Mimic 1.11.1
What's Changed
- Fix/repeat until failure by @sgtpepper43 in #91
New Contributors
- @sgtpepper43 made their first contribution in #91
Full Changelog: v1.11.0...v1.11.1