style(ntfy): fix bracket-spacing lint offenses

This commit is contained in:
Min Zeya Phyo
2026-07-28 02:34:26 +08:00
parent 20927eea5f
commit ac2054e45c
13 changed files with 1502 additions and 70 deletions

View File

@@ -0,0 +1,48 @@
require "test_helper"
class AdminSessionsFlowTest < ActionDispatch::IntegrationTest
def setup
@admin = AdminUser.create!(name: "Site Admin", email: "admin@example.com", password: "supersecret123")
end
test "login page renders the sign-in form" do
get admin_login_path
assert_response :success
assert_match "MySMSAPio", response.body
assert_match "Sign in", response.body
end
test "login page displays the auth error message on failed login" do
post admin_login_path, params: { email: "admin@example.com", password: "wrong-password" }
assert_response :unprocessable_entity
# The critical regression check: the alert must be present in the rendered HTML
assert_match "Invalid email or password", response.body
end
test "successful login redirects to the dashboard and shows welcome notice" do
post admin_login_path, params: { email: "admin@example.com", password: "supersecret123" }
assert_redirected_to admin_dashboard_path
follow_redirect!
assert_match "Welcome back", response.body
end
test "login is case-insensitive for email" do
post admin_login_path, params: { email: "ADMIN@example.com", password: "supersecret123" }
assert_redirected_to admin_dashboard_path
end
test "logging out clears the session and shows notice on the login page" do
post admin_login_path, params: { email: "admin@example.com", password: "supersecret123" }
delete admin_logout_path
assert_redirected_to admin_login_path
follow_redirect!
assert_match "logged out", response.body
end
test "protected admin page redirects to login with an alert" do
get admin_dashboard_path
assert_redirected_to admin_login_path
follow_redirect!
assert_match "Please log in to continue", response.body
end
end