You can use def setup
with the meta
has just for this.
Example:
defmodule DeckTest do
use ExUnit.Case
setup do
{:ok, cards: [:ace, :king, :queen] }
end
test "the truth", meta do
assert meta[:cards] == [:ace, :king, :queen]
end
end
Here's some more info