Update User generator for tests.

dev
KKlochko 5 months ago
parent 87dd98bd0a
commit 73f2f8c261

@ -3,6 +3,7 @@ defmodule DecentralisedBookIndex.Generators do
use Ash.Generator
alias DecentralisedBookIndex.Metadata
alias DecentralisedBookIndex.Accounts
@doc """
Generates user changesets with the `:register_with_password` action.
@ -19,6 +20,10 @@ defmodule DecentralisedBookIndex.Generators do
password_confirmation: "password"
],
overrides: opts,
after_action: fn user ->
role = opts[:role] || :user
Accounts.User.set_role!(user, role, authorize?: false)
end,
authorize?: false
)
end

Loading…
Cancel
Save