mirror of
https://github.com/kieraneglin/pinchflat.git
synced 2026-01-23 02:24:24 +00:00
* [WIP] renamed current settings module and tables to have backup suffix * Created new settings table, schema, and context * Migrated from old settings module to new one * Removed settings backup modules * Added some tests and docs
34 lines
1,021 B
Elixir
34 lines
1,021 B
Elixir
defmodule PinchflatWeb.PageControllerTest do
|
|
use PinchflatWeb.ConnCase
|
|
|
|
alias Pinchflat.Settings
|
|
|
|
describe "GET / when testing onboarding" do
|
|
test "sets the onboarding setting to true when onboarding", %{conn: conn} do
|
|
_conn = get(conn, ~p"/")
|
|
assert Settings.get!(:onboarding)
|
|
end
|
|
|
|
test "displays the onboarding page when onboarding is forced", %{conn: conn} do
|
|
Settings.set(onboarding: false)
|
|
|
|
conn = get(conn, ~p"/?onboarding=1")
|
|
assert html_response(conn, 200) =~ "Welcome to Pinchflat"
|
|
end
|
|
|
|
test "sets the onboarding setting to false if you pass the corrent query param", %{conn: conn} do
|
|
conn = get(conn, ~p"/")
|
|
assert Settings.get!(:onboarding)
|
|
|
|
_conn = get(conn, ~p"/?onboarding=0")
|
|
refute Settings.get!(:onboarding)
|
|
end
|
|
|
|
test "displays the home page when not onboarding", %{conn: conn} do
|
|
Settings.set(onboarding: false)
|
|
|
|
conn = get(conn, ~p"/")
|
|
assert html_response(conn, 200) =~ "MENU"
|
|
end
|
|
end
|
|
end
|