add setup foundations: site gate, registration lockdown, coming soon page
- Settings.site_live?/0 and set_site_live/1 for shop visibility control - Accounts.has_admin?/0 to detect single-tenant admin existence - Registration lockdown: /users/register redirects when admin exists - Setup.setup_status/0 aggregates provider, product, and stripe checks - Coming soon page at /coming-soon with themed styling - ThemeHook :require_site_live gate on all public shop routes - Site live → everyone through - Authenticated → admin preview through - No admin → fresh install demo through - Otherwise → redirect to coming soon - Go live / take offline toggle on /admin/settings - 648 tests, 0 failures Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,13 +5,21 @@ defmodule SimpleshopThemeWeb.UserLive.RegistrationTest do
|
||||
import SimpleshopTheme.AccountsFixtures
|
||||
|
||||
describe "Registration page" do
|
||||
test "renders registration page", %{conn: conn} do
|
||||
test "renders registration page when no admin exists", %{conn: conn} do
|
||||
{:ok, _lv, html} = live(conn, ~p"/users/register")
|
||||
|
||||
assert html =~ "Register"
|
||||
assert html =~ "Log in"
|
||||
end
|
||||
|
||||
test "redirects to login when admin already exists", %{conn: conn} do
|
||||
user_fixture()
|
||||
|
||||
assert {:error,
|
||||
{:redirect, %{to: "/users/log-in", flash: %{"error" => "Registration is closed"}}}} =
|
||||
live(conn, ~p"/users/register")
|
||||
end
|
||||
|
||||
test "redirects if already logged in", %{conn: conn} do
|
||||
result =
|
||||
conn
|
||||
|
||||
Reference in New Issue
Block a user