ash/test/resource/policies_test.exs
Zach Daniel d593e3cee9 improvement: error at compile for bypasses that will have no effect
chore: remove unused `checks` field from `%Ash.Policy.Authorizer.Policy{}`
2024-08-20 21:30:55 -04:00

27 lines
863 B
Elixir

defmodule Ash.Test.Resource.PoliciesTest do
@moduledoc false
use ExUnit.Case, async: true
test "records can belong to other resources" do
assert_raise Spark.Error.DslError,
~r/Bypass policies that can only ever forbid have no effect/,
fn ->
defmodule HasBadBypassPolicy do
use Ash.Resource,
domain: Ash.Test.Domain,
authorizers: [Ash.Policy.Authorizer]
attributes do
uuid_primary_key :id
end
policies do
bypass always() do
forbid_if always()
forbid_unless always()
end
end
end
end
end
end