ash/test/resource/validate_accept_test.exs
Zach Daniel baa3289a09 fix: properly retain input order for embedded attributes
improvement: better error messages for private attribute accepting
2024-03-29 21:24:05 -04:00

33 lines
853 B
Elixir

defmodule Ash.Test.Resource.ValidateAcceptTest do
@moduledoc false
use ExUnit.Case, async: true
import Ash.Test.Helpers
alias Spark.Error.DslError
test "Accepting an attribute that does not exist raises an error" do
assert_raise DslError, ~r/\[:invalid\], because they are not attributes/, fn ->
defposts do
actions do
default_accept :*
create :example_action, accept: [:invalid]
end
end
end
end
test "Accepting an attribute that is private raises an error" do
assert_raise DslError, ~r/\[:secret\], because they are not public attributes/, fn ->
defposts do
attributes do
attribute :secret, :string
end
actions do
default_accept :*
create :example_action, accept: [:secret]
end
end
end
end
end