This commit is contained in:
Alex Sherman 2020-06-17 11:06:43 +05:00
parent b446cff3fd
commit 68d32568fc
6 changed files with 16 additions and 15 deletions

View file

@ -2,7 +2,6 @@ language: ruby
cache: bundler
env:
- DB=postgresql
bundler_args: --without development staging production
before_install:
- "wget -N http://chromedriver.storage.googleapis.com/2.43/chromedriver_linux64.zip -P ~/"
- "unzip ~/chromedriver_linux64.zip -d ~/"
@ -10,6 +9,7 @@ before_install:
- "sudo mv -f ~/chromedriver /usr/local/share/"
- "sudo chmod +x /usr/local/share/chromedriver"
- "sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver"
before_script:
- "cp config/application.yml.sample config/application.yml"
- "echo \"openssl_config_path: 'test/fixtures/files/test_ca/openssl.cnf'\" >> config/application.yml"
@ -19,6 +19,7 @@ before_script:
- "echo \"ca_key_path: 'test/fixtures/files/test_ca/private/ca.key.pem'\" >> config/application.yml"
- "echo \"ca_key_password: 'password'\" >> config/application.yml"
- "cp config/database_travis.yml config/database.yml"
- "bundle config set without 'development staging production'"
- "bundle exec rake db:setup:all"
- "bundle exec rake data:migrate"
- "curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter"

View file

@ -78,11 +78,11 @@ module Concerns
def process_result(result:, field:)
case result[:errors].keys.first
when :smtp
errors.add(field, I18n.t('email.email_smtp_check_error'))
errors.add(field, I18n.t('email_verifable.email_smtp_check_error'))
when :mx
errors.add(field, I18n.t('email.email_mx_check_error'))
errors.add(field, I18n.t('email_verifable.email_mx_check_error'))
when :regex
errors.add(field, I18n.t('email.email_regex_check_error'))
errors.add(field, I18n.t('email_verifable.email_regex_check_error'))
end
end
end

View file

@ -1,5 +1,5 @@
en:
email:
email_verifable:
email_smtp_check_error: SMTP check error
email_mx_check_error: Mail domain not found
email_regex_check_error: Invalid format

View file

@ -1,5 +1,5 @@
et:
email:
email_verifable:
email_smtp_check_error: Eposti aadressi ei leitud (SMTP viga)
email_mx_check_error: Eposti aadressi domeeni ei leitud
email_regex_check_error: Eposti aadress on vigane

View file

@ -78,7 +78,7 @@ class ContactTest < ActiveSupport::TestCase
contact = valid_contact
contact.email = 'somecrude1337joke@internet.ee'
assert contact.invalid?
assert_equal I18n.t('email.email_smtp_check_error'), contact.errors.messages[:email].first
assert_equal I18n.t('email_verifable.email_smtp_check_error'), contact.errors.messages[:email].first
end
def test_email_verification_mx_error
@ -87,7 +87,7 @@ class ContactTest < ActiveSupport::TestCase
contact = valid_contact
contact.email = 'somecrude31337joke@somestrange31337domain.ee'
assert contact.invalid?
assert_equal I18n.t('email.email_mx_check_error'), contact.errors.messages[:email].first
assert_equal I18n.t('email_verifable.email_mx_check_error'), contact.errors.messages[:email].first
end
def test_email_verification_regex_error
@ -96,7 +96,7 @@ class ContactTest < ActiveSupport::TestCase
contact = valid_contact
contact.email = 'some@strangesentence@internet.ee'
assert contact.invalid?
assert_equal I18n.t('email.email_regex_check_error'), contact.errors.messages[:email].first
assert_equal I18n.t('email_verifable.email_regex_check_error'), contact.errors.messages[:email].first
end
def test_invalid_without_phone

View file

@ -56,7 +56,7 @@ class RegistrarTest < ActiveSupport::TestCase
registrar.billing_email = nil
assert registrar.invalid?
assert_equal I18n.t('email.email_smtp_check_error'), registrar.errors.messages[:email].first
assert_equal I18n.t('email_verifable.email_smtp_check_error'), registrar.errors.messages[:email].first
end
def test_email_verification_mx_error
@ -67,7 +67,7 @@ class RegistrarTest < ActiveSupport::TestCase
registrar.billing_email = nil
assert registrar.invalid?
assert_equal I18n.t('email.email_mx_check_error'), registrar.errors.messages[:email].first
assert_equal I18n.t('email_verifable.email_mx_check_error'), registrar.errors.messages[:email].first
end
def test_email_verification_regex_error
@ -78,7 +78,7 @@ class RegistrarTest < ActiveSupport::TestCase
registrar.billing_email = nil
assert registrar.invalid?
assert_equal I18n.t('email.email_regex_check_error'), registrar.errors.messages[:email].first
assert_equal I18n.t('email_verifable.email_regex_check_error'), registrar.errors.messages[:email].first
end
def test_billing_email_verification_valid
@ -95,7 +95,7 @@ class RegistrarTest < ActiveSupport::TestCase
registrar.billing_email = 'somecrude1337joke@internet.ee'
assert registrar.invalid?
assert_equal I18n.t('email.email_smtp_check_error'), registrar.errors.messages[:billing_email].first
assert_equal I18n.t('email_verifable.email_smtp_check_error'), registrar.errors.messages[:billing_email].first
end
def test_billing_email_verification_mx_error
@ -105,7 +105,7 @@ class RegistrarTest < ActiveSupport::TestCase
registrar.billing_email = 'somecrude31337joke@somestrange31337domain.ee'
assert registrar.invalid?
assert_equal I18n.t('email.email_mx_check_error'), registrar.errors.messages[:billing_email].first
assert_equal I18n.t('email_verifable.email_mx_check_error'), registrar.errors.messages[:billing_email].first
end
def test_billing_email_verification_regex_error
@ -115,7 +115,7 @@ class RegistrarTest < ActiveSupport::TestCase
registrar.billing_email = 'some@strangesentence@internet.ee'
assert registrar.invalid?
assert_equal I18n.t('email.email_regex_check_error'), registrar.errors.messages[:billing_email].first
assert_equal I18n.t('email_verifable.email_regex_check_error'), registrar.errors.messages[:billing_email].first
end
def test_creates_email_verification_in_unicode