+ try_password_login user.display_name.upcase, "test"
+
+ assert_template "changeset/history"
+ assert_select "span.username", user.display_name
+ end
+
+ def test_login_username_password_downcase
+ user = create(:user)
+
+ try_password_login user.display_name.downcase, "test"
+
+ assert_template "changeset/history"
+ assert_select "span.username", user.display_name
+ end
+
+ def test_login_username_password_pending
+ user = create(:user, :pending)
+
+ try_password_login user.display_name, "test"
+
+ assert_template "confirm"
+ assert_select "span.username", false
+ end
+
+ def test_login_username_password_pending_upcase
+ user = create(:user, :pending)
+
+ try_password_login user.display_name.upcase, "test"
+
+ assert_template "confirm"
+ assert_select "span.username", false
+ end
+
+ def test_login_username_password_pending_downcase
+ user = create(:user, :pending)
+
+ try_password_login user.display_name.downcase, "test"
+
+ assert_template "confirm"
+ assert_select "span.username", false
+ end
+
+ def test_login_username_password_suspended
+ user = create(:user, :suspended)
+
+ try_password_login user.display_name, "test"
+
+ assert_template "login"
+ assert_select "span.username", false
+ assert_select "div.flash.error", /your account has been suspended/
+ end
+
+ def test_login_username_password_suspended_upcase
+ user = create(:user, :suspended)
+
+ try_password_login user.display_name.upcase, "test"