From dc5c3d6eea1e8432d1df4c4ba55550410dd68f07 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sat, 10 Jan 2015 17:04:58 +0000 Subject: [PATCH] Fix login tests to check whether logins succeed/fail as expected --- test/integration/user_login_test.rb | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/test/integration/user_login_test.rb b/test/integration/user_login_test.rb index 66f8f4b09..ec91c1adc 100644 --- a/test/integration/user_login_test.rb +++ b/test/integration/user_login_test.rb @@ -27,6 +27,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest follow_redirect! assert_response :success assert_template 'changeset/history' + assert_select "span.username", "test" end def test_login_email_password_normal_upcase @@ -48,7 +49,8 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_response :redirect follow_redirect! assert_response :success - assert_template 'login' + assert_template 'changeset/history' + assert_select "span.username", "TEST" end def test_login_email_password_normal_titlecase @@ -71,6 +73,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest follow_redirect! assert_response :success assert_template 'login' + assert_select "span.username", false end def test_login_email_password_public @@ -93,6 +96,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest follow_redirect! assert_response :success assert_template 'changeset/history' + assert_select "span.username", "test2" end def test_login_email_password_public_upcase @@ -115,6 +119,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest follow_redirect! assert_response :success assert_template 'changeset/history' + assert_select "span.username", "test2" end def test_login_email_password_public_titlecase @@ -137,6 +142,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest follow_redirect! assert_response :success assert_template 'changeset/history' + assert_select "span.username", "test2" end def test_login_username_password_normal @@ -159,6 +165,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest follow_redirect! assert_response :success assert_template 'changeset/history' + assert_select "span.username", "test" end def test_login_username_password_normal_upcase @@ -180,7 +187,8 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_response :redirect follow_redirect! assert_response :success - assert_template 'login' + assert_template 'changeset/history' + assert_select "span.username", "TEST" end def test_login_username_password_normal_titlecase @@ -203,6 +211,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest follow_redirect! assert_response :success assert_template 'login' + assert_select "span.username", false end def test_login_username_password_public @@ -225,6 +234,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest follow_redirect! assert_response :success assert_template 'changeset/history' + assert_select "span.username", "test2" end def test_login_username_password_public_upcase @@ -247,6 +257,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest follow_redirect! assert_response :success assert_template 'changeset/history' + assert_select "span.username", "test2" end def test_login_username_password_public_titlecase @@ -269,6 +280,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest follow_redirect! assert_response :success assert_template 'changeset/history' + assert_select "span.username", "test2" end def test_login_openid_success @@ -287,6 +299,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest follow_redirect! assert_response :success assert_template 'changeset/history' + assert_select "span.username", "openIDuser" end def test_login_openid_cancel @@ -305,6 +318,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest follow_redirect! assert_response :success assert_template 'login' + assert_select "span.username", false end def test_login_openid_invalid_provider @@ -319,6 +333,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest follow_redirect! assert_response :success assert_template 'login' + assert_select "span.username", false end def test_login_openid_invalid_url @@ -333,6 +348,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest follow_redirect! assert_response :success assert_template 'login' + assert_select "span.username", false end def test_login_openid_unknown @@ -351,5 +367,6 @@ class UserLoginTest < ActionDispatch::IntegrationTest follow_redirect! assert_response :success assert_template 'user/new' + assert_select "span.username", false end end -- 2.43.2