smokestack/test/support/factory.ex

43 lines
1.2 KiB
Elixir
Raw Normal View History

2023-08-10 21:01:45 +12:00
defmodule Support.Factory do
@moduledoc false
use Smokestack
factory Support.Author do
attribute :name, &Faker.Person.name/0
attribute :email, &Faker.Internet.email/0
end
factory Support.Author, :trek do
2024-03-28 10:04:54 +13:00
attribute :name, choose(["JL", "Dr Mark", "BLT", "Cal Hudson"])
2023-08-10 21:01:45 +12:00
attribute :email, fn
%{name: "JL"} -> "captain@entrepreneur.starfleet"
%{name: "Dr Mark"} -> "cheifmed@voyager.starfleet"
2023-08-10 21:01:45 +12:00
%{name: "BLT"} -> "cheifeng@voyager.starfleet"
%{name: "Cal Hudson"} -> "cal@maquis.rebellion"
2023-08-10 21:01:45 +12:00
end
end
factory Support.Post do
2024-03-28 10:04:54 +13:00
domain Support.Domain
2023-08-10 21:01:45 +12:00
attribute :title, &Faker.Commerce.product_name/0
attribute :tags, n_times(3..20, &Faker.Lorem.word/0)
attribute :body, &Faker.Markdown.markdown/0
attribute :sub_title, &Faker.Lorem.sentence/0
2023-08-10 21:01:45 +12:00
end
factory Support.Post, :trek do
attribute :title,
choose([
"On the safety of conference attendance",
"Who would win? Q vs Kevin Uxbridge - an analysis",
"Improvised tools for warp core maintenance",
"Cardassia Prime: Hot or Not?"
])
attribute :body, &Faker.Markdown.markdown/0
end
end