diff --git a/mix.lock b/mix.lock index 0795d56..d61ed9a 100644 --- a/mix.lock +++ b/mix.lock @@ -1,6 +1,6 @@ %{ "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, - "castore": {:hex, :castore, "1.0.7", "b651241514e5f6956028147fe6637f7ac13802537e895a724f90bf3e36ddd1dd", [:mix], [], "hexpm", "da7785a4b0d2a021cd1292a60875a784b6caef71e76bf4917bdee1f390455cf5"}, + "castore": {:hex, :castore, "1.0.8", "dedcf20ea746694647f883590b82d9e96014057aff1d44d03ec90f36a5c0dc6e", [:mix], [], "hexpm", "0b2b66d2ee742cb1d9cb8c8be3b43c3a70ee8651f37b75a8b982e036752983f1"}, "credo": {:hex, :credo, "1.7.7", "771445037228f763f9b2afd612b6aa2fd8e28432a95dbbc60d8e03ce71ba4446", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "8bc87496c9aaacdc3f90f01b7b0582467b69b4bd2441fe8aae3109d843cc2f2e"}, "dialyxir": {:hex, :dialyxir, "1.4.3", "edd0124f358f0b9e95bfe53a9fcf806d615d8f838e2202a9f430d59566b6b53b", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "bf2cfb75cd5c5006bec30141b131663299c661a864ec7fbbc72dfa557487a986"}, "earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"}, diff --git a/test/let_me/policy_test.exs b/test/let_me/policy_test.exs index 7b8c14d..9340c8d 100644 --- a/test/let_me/policy_test.exs +++ b/test/let_me/policy_test.exs @@ -261,17 +261,23 @@ defmodule LetMe.PolicyTest do Policy.filter_allowed_actions(rules, %{id: 2}, object) assert [%Rule{name: :article_create}, %Rule{name: :article_view}] = - Policy.filter_allowed_actions( - rules, - %{id: 2, role: :writer}, - object + Enum.sort_by( + Policy.filter_allowed_actions( + rules, + %{id: 2, role: :writer}, + object + ), + & &1.name ) assert [%Rule{name: :article_create}, %Rule{name: :article_view}] = - Policy.filter_allowed_actions( - rules, - %{id: 2, role: :admin}, - object + Enum.sort_by( + Policy.filter_allowed_actions( + rules, + %{id: 2, role: :admin}, + object + ), + & &1.name ) assert [ @@ -284,10 +290,13 @@ defmodule LetMe.PolicyTest do %{id: 1, role: :admin}, object ) - |> Enum.sort() + |> Enum.sort_by(& &1.name) assert [%Rule{name: :article_update}, %Rule{name: :article_view}] = - Policy.filter_allowed_actions(rules, %{id: 1}, object) + Enum.sort_by( + Policy.filter_allowed_actions(rules, %{id: 1}, object), + & &1.name + ) end test "can filter by passing the struct only" do