mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 05:23:18 +12:00
37cc01957d
* WIP * chore: fix mix.lock merge issues * improvement: upgrade to 3.0 * chore: remove `repo.to_tenant` * chore: continue removal of unnecessary helper * chore: use `Ash.ToTenant`
28 lines
807 B
Elixir
28 lines
807 B
Elixir
defmodule AshPostgres.Test.CustomIndexTest do
|
|
use AshPostgres.RepoCase, async: false
|
|
alias AshPostgres.Test.Post
|
|
|
|
require Ash.Query
|
|
|
|
test "unique constraint errors are properly caught" do
|
|
Post
|
|
|> Ash.Changeset.for_create(:create, %{
|
|
title: "first",
|
|
uniq_custom_one: "what",
|
|
uniq_custom_two: "what2"
|
|
})
|
|
|> Ash.create!()
|
|
|
|
assert_raise Ash.Error.Invalid,
|
|
~r/Invalid value provided for uniq_custom_one: dude what the heck/,
|
|
fn ->
|
|
Post
|
|
|> Ash.Changeset.for_create(:create, %{
|
|
title: "first",
|
|
uniq_custom_one: "what",
|
|
uniq_custom_two: "what2"
|
|
})
|
|
|> Ash.create!()
|
|
end
|
|
end
|
|
end
|