Skip to content

Commit

Permalink
Use Plug instead of manual adding assigns.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaddox5 committed Apr 25, 2024
1 parent 8c5a03d commit 5bcf2b9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions test/support/conn_case.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ defmodule ScreenplayWeb.ConnCase do
this option is not recommended for other databases.
"""

import Plug.Conn
use ExUnit.CaseTemplate

using do
Expand Down Expand Up @@ -45,7 +44,7 @@ defmodule ScreenplayWeb.ConnCase do
"roles" => ["screenplay-emergency-admin"]
})
|> Plug.Conn.put_session(:username, user)
|> assign(:roles, [:emergency_admin])
|> Plug.run([{ScreenplayWeb.Plugs.Metadata, []}])

{conn, user}

Expand All @@ -57,7 +56,7 @@ defmodule ScreenplayWeb.ConnCase do
|> Plug.Test.init_test_session(%{})
|> Guardian.Plug.sign_in(ScreenplayWeb.AuthManager, user, %{roles: []})
|> Plug.Conn.put_session(:username, user)
|> assign(:roles, [])
|> Plug.run([{ScreenplayWeb.Plugs.Metadata, []}])

{conn, user}

Expand All @@ -71,7 +70,7 @@ defmodule ScreenplayWeb.ConnCase do
"roles" => ["pa-message-admin"]
})
|> Plug.Conn.put_session(:username, user)
|> assign(:roles, [:pa_message_admin])
|> Plug.run([{ScreenplayWeb.Plugs.Metadata, []}])

{conn, user}

Expand Down

0 comments on commit 5bcf2b9

Please sign in to comment.