memEx/test/support/fixtures/pipelines_fixtures.ex
2022-11-26 20:37:56 -05:00

27 lines
666 B
Elixir

defmodule Memex.PipelinesFixtures do
@moduledoc """
This module defines test helpers for creating
entities via the `Memex.Pipelines` context.
"""
alias Memex.{Accounts.User, Pipelines, Pipelines.Pipeline}
@doc """
Generate a pipeline.
"""
@spec pipeline_fixture(User.t()) :: Pipeline.t()
@spec pipeline_fixture(attrs :: map(), User.t()) :: Pipeline.t()
def pipeline_fixture(attrs \\ %{}, user) do
{:ok, pipeline} =
attrs
|> Enum.into(%{
description: "some description",
tag: [],
title: "some title",
visibility: :private
})
|> Pipelines.create_pipeline(user)
pipeline
end
end