Skip to content

v0.7.0

Compare
Choose a tag to compare
@brandonjoyce brandonjoyce released this 22 Apr 02:30
· 21 commits to master since this release

This release adds the new stub syntax which is a great improvement over the old double/allow syntax. stub combines both into one function now:

dbl = ModuleOrBehavior
|> stub(:function_name, fn(x) -> x end)
|> stub(:another_function, fn(x) -> x end)
dbl.function_name("hello")
assert_receive({ModuleOrBehavior, :function_name, ["hello"]})

You'll notice that the message now contains the module or behavior atom that the stub is built against. This prevents conflicts w/ function names between different modules and is another improvement that the stub syntax provides.

The old double/allow syntax is no longer documented, but isn't marked as deprecated yet. We may consider that in the future, or maybe even dropping support for it in version 1.0.

For more details on the new syntax, please read the docs!