Skip to content

Instantly share code, notes, and snippets.


shankardevy/load_customer_test.exs Secret

Last active Aug 22, 2017
What would you like to do?
defmodule MangoWeb.Plugs.LoadCustomerTest do
use MangoWeb.ConnCase
alias Mango.CRM
@valid_attrs %{
"name" => "John",
"email" => "",
"password" => "secret",
"residence_area" => "Area 1",
"phone" => "1111"
test "fetch cart from session on subsequent visit" do
# Create a new customer
{:ok, customer} = CRM.create_customer(@valid_attrs)
# Build a new conn by posting login data to "/session" path
conn = post build_conn(), "/login", %{"session" => @valid_attrs }
# We reuse the same conn now instead of building a new one
conn = get conn, "/"
# now we expect the conn to have the `:current_customer` data loaded in conn.
assert ==
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment