2022-04-07 17:14:07 +12:00
|
|
|
defmodule Ash.Test.Resource.RequireUniqueActionNamesTest do
|
|
|
|
@moduledoc false
|
|
|
|
use ExUnit.Case, async: true
|
|
|
|
|
2022-04-07 17:52:59 +12:00
|
|
|
import Ash.Test.Helpers
|
2022-04-07 17:14:07 +12:00
|
|
|
|
|
|
|
test "fails if there are multiple read actions" do
|
|
|
|
assert_raise(
|
|
|
|
Ash.Error.Dsl.DslError,
|
|
|
|
~r/Multiple actions \(2\) with the name `read` defined in/,
|
|
|
|
fn ->
|
|
|
|
defposts do
|
|
|
|
actions do
|
|
|
|
defaults [:read]
|
|
|
|
read :read
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
test "passes if there is one default read action" do
|
|
|
|
defposts do
|
|
|
|
actions do
|
|
|
|
defaults [:read]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-04-07 17:52:59 +12:00
|
|
|
test "passes if there is only one defined action" do
|
2022-04-07 17:14:07 +12:00
|
|
|
defposts do
|
|
|
|
actions do
|
|
|
|
read :read
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|