summaryrefslogtreecommitdiff
path: root/users/test/unit/email_test.rb
diff options
context:
space:
mode:
authorazul <azul@riseup.net>2013-01-17 22:45:39 -0800
committerazul <azul@riseup.net>2013-01-17 22:45:39 -0800
commit168c36b578d675c99aad62a350aa68cc1b6d1316 (patch)
treecd1df0a9a7d3f0a9812b512cfb93db0f79b0421f /users/test/unit/email_test.rb
parent19d563e2e2db98ecc5143229f554df6a09bc457e (diff)
parent27730c7e665ed64e691fdf6dbeebc39c8bfbbc4b (diff)
Merge pull request #18 from leapcode/feature/fixed-email-address
make email address just login@domain.tld
Diffstat (limited to 'users/test/unit/email_test.rb')
-rw-r--r--users/test/unit/email_test.rb61
1 files changed, 0 insertions, 61 deletions
diff --git a/users/test/unit/email_test.rb b/users/test/unit/email_test.rb
deleted file mode 100644
index d7ef1f8..0000000
--- a/users/test/unit/email_test.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-require 'test_helper'
-
-class EmailTest < ActiveSupport::TestCase
-
- setup do
- @user = FactoryGirl.build :user
- @other_user = FactoryGirl.build :user
- @email_string = "valid_alias@#{APP_CONFIG[:domain]}"
- User.find_by_email_or_alias(@email_string).try(:destroy)
- end
-
- teardown do
- @user.destroy if @user.persisted? # just in case
- @other_user.destroy if @other_user.persisted?
- end
-
- test "email needs to be different from other peoples email" do
- @other_user.email = @email_string
- @other_user.save
- assert_invalid_email @email_string
- end
-
- test "email needs to be different from other peoples email aliases" do
- @other_user.email_aliases.build :email => @email_string
- @other_user.save
- assert_invalid_email @email_string
- end
-
- test "email needs to be different from email aliases" do
- @user.email_aliases.build :email => @email_string
- @user.save
- assert_invalid_email @email_string
- end
-
- test "non local emails are invalid" do
- assert_invalid_email "not_valid@mail.me"
- end
-
- test "local emails are valid" do
- local_email = "valid@#{APP_CONFIG[:domain]}"
- @user.email = local_email
- @user.valid?
- assert_equal Hash.new, @user.errors.messages
- end
-
- test "find user by email" do
- email = "finding@test.me"
- @user.email = email
- @user.save
- assert_equal @user, User.find_by_email(email)
- assert_equal @user, User.find_by_email_or_alias(email)
- assert_nil User.find_by_email_alias(email)
- end
-
- def assert_invalid_email(string)
- @user.email = string
- assert !@user.valid?
- assert @user.errors.keys.include?(:email)
- end
-
-end