How to create dummy reference in Elixir?

Background

Let’s say I am testing a function which has a dependency that returns a reference if everything was OK. I am stubbing this dependency and for the sake of keeping my stub’s API consistent with the thing I am stubbing, I want to return a fake reference.

Question

Is there a way to create dummy references in Elixir?

PS: An example of a function that returns a reference is :ets.new.

make_ref/0
3 Likes

ref/1

Creates a Reference from string.

Examples

iex> ref("0.21.32.43")
#Reference<0.21.32.43>
2 Likes