File size: 535 Bytes
6778ee0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
defmodule PlausibleWeb.PageControllerTest do
  use PlausibleWeb.ConnCase, async: true

  setup {PlausibleWeb.FirstLaunchPlug.Test, :skip}

  describe "GET /" do
    setup [:create_user, :log_in]

    test "shows landing page when user not authenticated" do
      assert build_conn() |> get("/") |> html_response(200) =~ "Welcome to Plausible!"
    end

    test "redirects to /sites if user is authenticated", %{conn: conn} do
      assert conn
             |> get("/")
             |> redirected_to(302) == "/sites"
    end
  end
end