Skip to content

Instantly share code, notes, and snippets.

@thebrianemory
Last active March 26, 2018 15:38
Show Gist options
  • Save thebrianemory/62f4ade122f5c3408d542af0727bf967 to your computer and use it in GitHub Desktop.
Save thebrianemory/62f4ade122f5c3408d542af0727bf967 to your computer and use it in GitHub Desktop.
defmodule CatcastsWeb.AuthControllerTest do
use CatcastsWeb.ConnCase
alias Catcasts.Repo # add this line
alias Catcasts.User # add this line
@ueberauth_auth %{credentials: %{token: "fdsnoafhnoofh08h38h"},
info: %{email: "batman@example.com", first_name: "Bruce", last_name: "Wayne"},
provider: :google}
... # Code removed for readability
# Add the below test
test "creates user from Google information", %{conn: conn} do
conn = conn
|> assign(:ueberauth_auth, @ueberauth_auth)
|> get("/auth/google/callback")
users = User |> Repo.all
assert Enum.count(users) == 1
assert get_flash(conn, :info) == "Thank you for signing in!"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment