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-26 14:51:18 -05:00
|
|
|
import Memex.Fixtures
|
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-12-15 22:33:10 -05:00
|
|
|
tags: ["example-tag"],
|
2022-11-26 14:51:18 -05:00
|
|
|
slug: random_slug(),
|
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
|