Skip to content

Commit

Permalink
add login() function to support/test_helpers.ex p.294 #1
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Aug 11, 2019
1 parent 202c4ab commit ee8e23d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions apps/rumbl_web/test/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,11 @@ defmodule RumblWeb.TestHelpers do
{:ok, video} = Rumbl.Multimedia.create_video(user, video_fields)
video
end

def login(%{conn: conn, login_as: username}) do
user = insert_user(username: username)
{Plug.Conn.assign(conn, :current_user, user), user}
end

def login(%{conn: conn}), do: {conn, :logged_out}
end

0 comments on commit ee8e23d

Please sign in to comment.