smokestack/README.md

65 lines
2.1 KiB
Markdown
Raw Normal View History

2023-08-09 20:18:46 +12:00
# Smokestack
2024-03-28 10:06:54 +13:00
[![Build Status](https://drone.harton.dev/api/badges/james/smokestack/status.svg?ref=refs/heads/main)](https://drone.harton.nz/james/smokestack)
2023-08-09 20:18:46 +12:00
[![Hippocratic License HL3-FULL](https://img.shields.io/static/v1?label=Hippocratic%20License&message=HL3-FULL&labelColor=5e2751&color=bc8c3d)](https://firstdonoharm.dev/version/3/0/full.html)
Smokestack provides a way to define test factories for your [Ash Resources](https://ash-hq.org/docs/module/ash/latest/ash-resource) using a convenient DSL:
```elixir
2023-08-10 21:01:45 +12:00
defmodule MyApp.Factory do
use Smokestack
2023-08-09 20:18:46 +12:00
2023-08-10 21:01:45 +12:00
factory Character do
attribute :name, &Faker.StarWars.character/0
attribute :affiliation, choose(["Galactic Empire", "Rebel Alliance"])
2023-08-09 20:18:46 +12:00
end
2023-08-10 21:01:45 +12:00
factory Character, :trek do
attribute :name, choose(["J.L. Pipes", "Severn", "Slickback"])
attribute :affiliation, choose(["Entrepreneur", "Voyager"])
end
end
defmodule MyApp.CharacterTest do
use MyApp.DataCase
use MyApp.Factory
2023-08-09 20:18:46 +12:00
2023-08-10 21:01:45 +12:00
test "it can build a character" do
assert character = insert!(Character)
2023-08-09 20:18:46 +12:00
end
end
```
## Installation
Smokestack is available on [Hex](https://hex.pm/packages/smokestack) you can
add it directly to your `mix.exs`:
2023-08-09 20:18:46 +12:00
```elixir
def deps do
[
2024-03-28 10:05:43 +13:00
{:smokestack, "~> 0.5.0-rc.0"},
2023-08-09 20:18:46 +12:00
]
end
```
Documentation for the latest release is available on [HexDocs](http://hexdocs.pm/smokestack).
## Github Mirror
This repository is mirrored [on Github](https://github.com/jimsynz/smokestack)
2024-03-08 14:47:42 +13:00
from it's primary location [on my Forgejo instance](https://harton.dev/james/smokestack).
Feel free to raise issues and open PRs on Github.
2023-08-09 20:18:46 +12:00
## License
This software is licensed under the terms of the
[HL3-FULL](https://firstdonoharm.dev), see the `LICENSE.md` file included with
this package for the terms.
This license actively proscribes this software being used by and for some
industries, countries and activities. If your usage of this software doesn't
comply with the terms of this license, then [contact me](mailto:james@harton.nz)
with the details of your use-case to organise the purchase of a license - the
cost of which may include a donation to a suitable charity or NGO.