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