 
   test "SessionsController DELETE delete" do
     user = create_user
-    conn = create_conn(:delete, sessions_path(Blog.Endpoint, :delete))
+    conn = create_conn(:delete, sessions_path(Endpoint, :delete))
     conn = sign_in(conn, user)
     assert current_user(conn).id == user.id
 

  end

  test "PostsController POST create" do
    conn = create_conn(:post, posts_path(Blog.Endpoint, :create), %{ post: %{ title: "foo", content: "bar" } })
    should_be_authenticated!(conn)

    conn = sign_in(conn, create_user)

  alias Blog.Post
  alias Blog.User
  alias Blog.Repo
  alias Blog.Endpoint

  @doc """
  Makes sure that conn is redirected with a flash if there's no user logged in.
  """
  def should_be_authenticated!(%Plug.Conn{} = conn) do
    conn = request(conn)
    assert get_flash(conn, :alert) == "You must be authenticated to proceed"
    assert conn.status == 302
  end

  @doc """
  Makes sure that conn is redirected with a flash if the user is already logged in.
  """
  def should_be_unauthenticated!(%Plug.Conn{} = conn, user \\ create_user) do
    conn = sign_in(conn, user)
    conn = request(conn)
