From 16b5777ed84f35eb1c3885b0577b54543edf7f80 Mon Sep 17 00:00:00 2001
From: Taico Aerts <t.v.aerts@tudelft.nl>
Date: Wed, 2 Aug 2023 18:23:51 +0200
Subject: [PATCH] Expand registration test

Check that confirming email is required.
---
 test/system/login_test.rb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/test/system/login_test.rb b/test/system/login_test.rb
index 4c29e7238..71e16d244 100644
--- a/test/system/login_test.rb
+++ b/test/system/login_test.rb
@@ -4,8 +4,9 @@ class LoginTest < ApplicationSystemTestCase
   test 'User can register a new account and sign-in to it after confirming their email' do
     email = 'test@test.com'
     username = 'Test User'
-    password = 'test123'
+    password = 'login_test_1'
 
+    # Sign up for an account
     visit root_url
     click_on 'Sign Up'
     fill_in 'Email', with: email
@@ -19,6 +20,11 @@ class LoginTest < ApplicationSystemTestCase
 
     user = User.last
 
+    # Try logging in directly, this should fail because not confirmed yet
+    log_in user, password
+    assert_selector '.notice', text: 'You have to confirm your email address before continuing.'
+
+    # Confirm email and sign in again, should succeed this time
     confirm_email user
     log_in user, password
     assert_selector '.notice', text: 'Signed in successfully.'
-- 
GitLab