fp/services/bright/test/support/fixtures/blog_fixtures.ex

22 lines
390 B
Elixir

defmodule Bright.BlogFixtures do
@moduledoc """
This module defines test helpers for creating
entities via the `Bright.Blog` context.
"""
@doc """
Generate a post.
"""
def post_fixture(attrs \\ %{}) do
{:ok, post} =
attrs
|> Enum.into(%{
body: "some body",
title: "some title"
})
|> Bright.Blog.create_post()
post
end
end