Test that reserved usernames are not allowed
authorTom Hughes <tom@compton.nu>
Thu, 2 Oct 2014 18:54:26 +0000 (19:54 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 2 Oct 2014 18:54:26 +0000 (19:54 +0100)
test/models/user_test.rb

index 93bb348ba361b4e43f3062ab5364b7a5fa2c421d..f10e8c0236d4dd4ee032798b9b29d400ceee9b33 100644 (file)
@@ -87,7 +87,9 @@ class UserTest < ActiveSupport::TestCase
     # should be used.
     bad = [ "<hr/>", "test@example.com", "s/f", "aa/", "aa;", "aa.",
             "aa,", "aa?", "/;.,?", "も対応します/", "#ping",
-            "foo\x1fbar", "foo\x7fbar", "foo\ufffebar", "foo\uffffbar" ]
+            "foo\x1fbar", "foo\x7fbar", "foo\ufffebar", "foo\uffffbar",
+            "new", "terms", "save", "confirm", "confirm-email",
+            "go_public", "reset-password", "forgot-password", "suspended" ]
     ok.each do |display_name|
       user = users(:normal_user)
       user.display_name = display_name
@@ -98,7 +100,6 @@ class UserTest < ActiveSupport::TestCase
       user = users(:normal_user)
       user.display_name = display_name
       assert !user.valid?, "#{display_name} is valid when it shouldn't be"
-      assert user.errors[:display_name].include?("is invalid")
     end
   end