ash_oban/test/ash_oban_test.exs

39 lines
657 B
Elixir
Raw Normal View History

2023-04-22 16:58:26 +12:00
defmodule AshObanTest do
use ExUnit.Case
doctest AshOban
defmodule Triggered do
use Ash.Resource,
data_layer: Ash.DataLayer.Ets,
extensions: [AshOban]
oban do
triggers do
2023-04-22 17:35:21 +12:00
trigger :process do
where expr(processed != true)
end
2023-04-22 16:58:26 +12:00
end
end
actions do
defaults [:read, :create]
update :process do
change set_attribute(:processed, true)
end
end
ets do
private? true
end
attributes do
uuid_primary_key :id
end
end
test "foo" do
assert [%AshOban.Trigger{action: :process}] = AshOban.Info.oban_triggers(Triggered)
end
end