chore: update ash, add tests for field policies

This commit is contained in:
Zach Daniel 2024-02-14 11:04:06 -05:00
parent be15759de0
commit 3146d5f97d
3 changed files with 5 additions and 27 deletions

View file

@ -158,7 +158,7 @@ defmodule AshPostgres.MixProject do
{:jason, "~> 1.0"},
{:postgrex, ">= 0.0.0"},
{:ash,
ash_version(github: "ash-project/ash", ref: "80fc8b0896f6ef59a26c220009cd20d6042ad7d2")},
ash_version(github: "ash-project/ash", ref: "e9d2d8c575f700ced88ed563fc015af8061f0df0")},
{:benchee, "~> 1.1", only: [:dev, :test]},
{:git_ops, "~> 2.5", only: [:dev, :test]},
{:ex_doc, github: "elixir-lang/ex_doc", only: [:dev, :test], runtime: false},

View file

@ -5,31 +5,6 @@ defmodule FilterFieldPolicyTest do
require Ash.Query
setup do
# I needed this to make the query actually fail
# this triggers an exeption in the reporting of
# the policy breakdowns because the policies are
# nil
# Without this it would just run the query which
# might be even worse as the policies are not applied
# correctly and I guess `nil` is a special case for
# field policies because you can have no polcies
# and that is still valid?
current_level = Logger.level()
current_setting = Application.get_env(:ash, :policies)
Application.put_env(
:ash,
:policies,
Keyword.merge(current_setting |> List.wrap(), log_policy_breakdowns: current_level)
)
on_exit(fn ->
Application.put_env(:ash, :policies, current_setting)
end)
end
test "filter uses the correct field policies when exanding refs" do
organization =
Organization

View file

@ -18,7 +18,10 @@ defmodule AshPostgres.Test.User do
end
relationships do
belongs_to(:organization, AshPostgres.Test.Organization)
belongs_to :organization, AshPostgres.Test.Organization do
attribute_writable?(true)
end
has_many(:accounts, AshPostgres.Test.Account)
end
end