summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--users/app/models/email.rb8
-rw-r--r--users/test/unit/identity_test.rb8
2 files changed, 2 insertions, 14 deletions
diff --git a/users/app/models/email.rb b/users/app/models/email.rb
index f38f2f5..a9a503f 100644
--- a/users/app/models/email.rb
+++ b/users/app/models/email.rb
@@ -3,16 +3,10 @@ class Email < String
validates :email,
:format => {
- :with => /\A([^@\s]+)@((?:[-a-zA-Z0-9]+\.)+[a-zA-Z]{2,})\Z/, #checks format, but allows lowercase
+ :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/, #local part of email is case-sensitive, so allow uppercase letter.
:message => "needs to be a valid email address"
}
- validates :email,
- :format => {
- :with => /\A[^A-Z]*\Z/, #forbids uppercase characters
- :message => "letters must be lowercase"
- }
-
def to_partial_path
"emails/email"
end
diff --git a/users/test/unit/identity_test.rb b/users/test/unit/identity_test.rb
index 02f14c0..0842a77 100644
--- a/users/test/unit/identity_test.rb
+++ b/users/test/unit/identity_test.rb
@@ -76,7 +76,7 @@ class IdentityTest < ActiveSupport::TestCase
assert_match /needs to end in/, id.errors[:address].first
end
- test "alias must meet some conditions as login" do
+ test "alias must meet same conditions as login" do
id = Identity.create_for @user, address: alias_name.capitalize
assert !id.valid?
#hacky way to do this, but okay for now:
@@ -90,12 +90,6 @@ class IdentityTest < ActiveSupport::TestCase
assert id.errors.messages[:destination].include? "needs to be a valid email address"
end
- test "only lowercase destination" do
- id = Identity.create_for @user, address: @user.email_address, destination: forward_address.capitalize
- assert !id.valid?
- assert id.errors.messages[:destination].include? "letters must be lowercase"
- end
-
def alias_name
@alias_name ||= Faker::Internet.user_name
end