File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 55defmodule AshPostgres.AtomicsTest do
66 alias AshPostgres.Test.Author
77 alias AshPostgres.Test.Comment
8+ alias AshPostgres.Test.TempEntity
89
910 use AshPostgres.RepoCase , async: false
1011
@@ -465,6 +466,16 @@ defmodule AshPostgres.AtomicsTest do
465466 assert post . score == 20
466467 end
467468
469+ test "atomic_set works on create with required attribute and fragment" do
470+ temp_entity =
471+ TempEntity
472+ |> Ash.Changeset . for_create ( :create , % { } )
473+ |> Ash.Changeset . atomic_set ( :full_name , expr ( fragment ( "(SELECT 'name')" ) ) )
474+ |> Ash . create! ( )
475+
476+ assert temp_entity . full_name == "name"
477+ end
478+
468479 test "atomic_set on create overrides attributes when both are set" do
469480 # If both attributes and atomic_set set a value, atomics should win
470481 post =
You can’t perform that action at this time.
0 commit comments