philomena/test/support/fixtures/channels_fixtures.ex

24 lines
491 B
Elixir
Raw Permalink Normal View History

2024-07-04 20:12:25 +02:00
defmodule Philomena.ChannelsFixtures do
@moduledoc """
This module defines test helpers for creating entities via the `Philomena.Channels` context.
"""
alias Philomena.Channels
def unique_name, do: "channel#{System.unique_integer()}"
def channel_fixture(attrs \\ %{}) do
name = unique_name()
{:ok, channel} =
attrs
|> Enum.into(%{
short_name: name,
type: "PicartoChannel"
})
|> Channels.create_channel()
channel
end
end