Skip to content

Releases: sonerdy/double

v0.8.2

29 Jan 03:37
Compare
Choose a tag to compare

Upgrade Elixir version, package updates and warning/deprecation fixes.

Allow concurrent eval

21 Jun 14:06
Compare
Choose a tag to compare

This helps to eliminate a bottleneck for highly concurrent usage of the library.

v0.7.0

22 Apr 02:30
Compare
Choose a tag to compare

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!

v0.6.6

06 Feb 04:22
Compare
Choose a tag to compare

This release includes fixes to prevent conflicts with auto imported functions from Kernel. Thanks to @JonRowe for the contribution!

v0.6.5

18 May 02:11
Compare
Choose a tag to compare

This is only a documentation update.

v0.6.4

21 Jan 21:03
Compare
Choose a tag to compare

Fixes warnings for Elixir 1.6 and applies new built-in code formatter. Credit to @take-five

v0.6.3

07 Oct 12:50
Compare
Choose a tag to compare

This release includes a fix for the typespec on allow/3.

v0.6.2

19 Aug 04:30
Compare
Choose a tag to compare

This release fixes an issue with verifications on module based doubles that have macros. Macros can now be stubbed whereas they would have thrown a verification error before.

For example, Logger.info/1 is a macro that you can now stub and it will be properly verified.

logger_stub = Logger
|> double()
|> allow(:info, fn(_msg) -> :ok end)

v0.6.1

27 Jul 13:02
Compare
Choose a tag to compare

This release will start essential Double services as part of an OTP application. This should help with with intermittent errors with starting and stopping services. Thanks @take-five!

v0.6.0

21 Jun 20:29
Compare
Choose a tag to compare

Clearing Stubbed Functions

Occasionally it's useful to clear the stubs for an existing double. This is useful when you have
a shared setup and a test needs to change the way a double is stubbed without recreating the whole thing.

stub = IO
|> double
|> allow(:puts, fn(_) -> :ok end)
|> allow(:inspect, fn(_) -> :ok end)

# later
stub |> clear(:puts) # clear an individual function
stub |> clear([:puts, :inspect]) # clear a list of functions
stub |> clear() # clear all functions