mirror of
https://github.com/ash-project/ash_sqlite.git
synced 2024-09-20 05:13:19 +12:00
28 lines
801 B
Elixir
28 lines
801 B
Elixir
defmodule AshSqlite.Test.CustomIndexTest do
|
|
use AshSqlite.RepoCase, async: false
|
|
alias AshSqlite.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
|