chore: update tests for latest ash atomics support

This commit is contained in:
Zach Daniel 2023-08-31 11:47:15 -04:00
parent 5a4a52854b
commit eabb745fc3
4 changed files with 6 additions and 6 deletions

View file

@ -161,7 +161,7 @@ defmodule AshPostgres.MixProject do
{:ecto, "~> 3.9"},
{:jason, "~> 1.0"},
{:postgrex, ">= 0.0.0"},
{:ash, ash_version(github: "ash-project/ash")},
{:ash, ash_version("~> 2.14 and >= 2.14.5")},
{:git_ops, "~> 2.5", only: [:dev, :test]},
{:ex_doc, "~> 0.22", only: [:dev, :test], runtime: false},
{:ex_check, "~> 0.14", only: [:dev, :test]},

View file

@ -1,5 +1,5 @@
%{
"ash": {:git, "https://github.com/ash-project/ash.git", "18cb24e7f720282d46ad6aed7ba065d9cd71604c", []},
"ash": {:hex, :ash, "2.14.5", "fee7e6962084be0929ffdbd56ea24f7a6a12e36d385b5cd53ef627cca2aa0269", [:mix], [{:comparable, "~> 1.0", [hex: :comparable, repo: "hexpm", optional: false]}, {:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:earmark, "~> 1.4", [hex: :earmark, repo: "hexpm", optional: true]}, {:ecto, "~> 3.7", [hex: :ecto, repo: "hexpm", optional: false]}, {:ets, "~> 0.8.0", [hex: :ets, repo: "hexpm", optional: false]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: false]}, {:picosat_elixir, "~> 0.2", [hex: :picosat_elixir, repo: "hexpm", optional: false]}, {:plug, ">= 0.0.0", [hex: :plug, repo: "hexpm", optional: true]}, {:spark, ">= 1.1.20 and < 2.0.0-0", [hex: :spark, repo: "hexpm", optional: false]}, {:stream_data, "~> 0.5.0", [hex: :stream_data, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.1", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "023e69a4d5dc95fd94fa873d98ea1ddcb413d21a7f2de8a50c8ac8b476b0abdb"},
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"},
"certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"},
"comparable": {:hex, :comparable, "1.0.0", "bb669e91cedd14ae9937053e5bcbc3c52bb2f22422611f43b6e38367d94a495f", [:mix], [{:typable, "~> 0.1", [hex: :typable, repo: "hexpm", optional: false]}], "hexpm", "277c11eeb1cd726e7cd41c6c199e7e52fa16ee6830b45ad4cdc62e51f62eb60c"},

View file

@ -13,7 +13,7 @@ defmodule AshPostgres.AtomicsTest do
assert %{price: 2} =
post
|> Ash.Changeset.for_update(:update, %{})
|> Ash.Changeset.atomic(:price, expr(price + 1))
|> Ash.Changeset.atomic_update(:price, expr(price + 1))
|> Api.update!()
end
@ -26,7 +26,7 @@ defmodule AshPostgres.AtomicsTest do
assert_raise Ash.Error.Invalid, ~r/does not exist/, fn ->
post
|> Ash.Changeset.for_update(:update, %{})
|> Ash.Changeset.atomic(:organization_id, Ash.UUID.generate())
|> Ash.Changeset.atomic_update(:organization_id, Ash.UUID.generate())
|> Api.update!()
end
end
@ -40,7 +40,7 @@ defmodule AshPostgres.AtomicsTest do
post =
post
|> Ash.Changeset.for_update(:update, %{})
|> Ash.Changeset.atomic(:score, expr(score_after_winning))
|> Ash.Changeset.atomic_update(:score, expr(score_after_winning))
|> Api.update!()
assert post.score == 1

View file

@ -64,7 +64,7 @@ defmodule AshPostgres.Test.Post do
update :increment_score do
argument(:amount, :integer, default: 1)
set(:score, expr((score || 0) + ^arg(:amount)))
change(atomic_update(:score, expr((score || 0) + ^arg(:amount))))
end
end