2024-02-16 17:23:57 +13:00
|
|
|
defmodule Ash.Flow.RunFromAction do
|
2023-07-19 06:48:26 +12:00
|
|
|
@moduledoc false
|
|
|
|
use ExUnit.Case, async: false
|
|
|
|
|
|
|
|
alias Ash.Test.Flow.Api
|
|
|
|
alias Ash.Test.Flow.ParentResource
|
|
|
|
|
|
|
|
@tag :"652"
|
|
|
|
# https://github.com/ash-project/ash/issues/652
|
|
|
|
test "Runs originated from resource action(Issue 652)" do
|
|
|
|
parent_resource =
|
|
|
|
ParentResource
|
|
|
|
|> Ash.Changeset.for_create(:create, %{status: :active})
|
|
|
|
|> Api.create!()
|
|
|
|
|
|
|
|
Ash.Test.Flow.ChildResource
|
|
|
|
|> Ash.Changeset.for_create(:create, %{parent_resource: parent_resource})
|
|
|
|
|> Api.create!(authorize?: false)
|
|
|
|
|
|
|
|
Ash.Test.Flow.ChildResource
|
|
|
|
|> Ash.Changeset.for_create(:create, %{parent_resource: parent_resource})
|
|
|
|
|> Api.create!(authorize?: false)
|
|
|
|
|
|
|
|
{:ok, %{status: :canceled}} =
|
|
|
|
ParentResource.cancel(parent_resource)
|
|
|
|
end
|
|
|
|
end
|