summaryrefslogtreecommitdiff
path: root/users/test/unit/identity_test.rb
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2013-09-05 14:00:50 -0700
committerjessib <jessib@riseup.net>2013-09-05 14:00:50 -0700
commit3ef22b5a856e1f576fb0a6a589b6b7ab41e1dd18 (patch)
treeb10e99e842a232686872606cd16f631b8397f279 /users/test/unit/identity_test.rb
parent8e8f5ddda08a883842a8c3e2ffa994e12b25dd39 (diff)
For moment, have identity's address handle aliased from login so we can use LoginFormatValidation. However, this is not how we will want it eventually.
One issue is that the errors messages are set on login, rather than the appropriate field.
Diffstat (limited to 'users/test/unit/identity_test.rb')
-rw-r--r--users/test/unit/identity_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/users/test/unit/identity_test.rb b/users/test/unit/identity_test.rb
index a77613a..b3918f1 100644
--- a/users/test/unit/identity_test.rb
+++ b/users/test/unit/identity_test.rb
@@ -76,6 +76,14 @@ class IdentityTest < ActiveSupport::TestCase
assert_match /needs to end in/, id.errors[:address].first
end
+ test "only lowercase alias" do
+ id = Identity.create_for @user, address: alias_name.capitalize
+ assert !id.valid?
+ #hacky way to do this, but okay for now:
+ assert id.errors.messages.flatten(2).include? "Must begin with a lowercase letter"
+ assert id.errors.messages.flatten(2).include? "Only lowercase letters, digits, . - and _ allowed."
+ end
+
def alias_name
@alias_name ||= Faker::Internet.user_name