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 cache: bundler
env: env:
- DB=postgresql - DB=postgresql
bundler_args: --without development staging production
before_install: before_install:
- "wget -N http://chromedriver.storage.googleapis.com/2.43/chromedriver_linux64.zip -P ~/" - "wget -N http://chromedriver.storage.googleapis.com/2.43/chromedriver_linux64.zip -P ~/"
- "unzip ~/chromedriver_linux64.zip -d ~/" - "unzip ~/chromedriver_linux64.zip -d ~/"
@ -10,6 +9,7 @@ before_install:
- "sudo mv -f ~/chromedriver /usr/local/share/" - "sudo mv -f ~/chromedriver /usr/local/share/"
- "sudo chmod +x /usr/local/share/chromedriver" - "sudo chmod +x /usr/local/share/chromedriver"
- "sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver" - "sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver"
before_script: before_script:
- "cp config/application.yml.sample config/application.yml" - "cp config/application.yml.sample config/application.yml"
- "echo \"openssl_config_path: 'test/fixtures/files/test_ca/openssl.cnf'\" >> 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_path: 'test/fixtures/files/test_ca/private/ca.key.pem'\" >> config/application.yml"
- "echo \"ca_key_password: 'password'\" >> config/application.yml" - "echo \"ca_key_password: 'password'\" >> config/application.yml"
- "cp config/database_travis.yml config/database.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 db:setup:all"
- "bundle exec rake data:migrate" - "bundle exec rake data:migrate"
- "curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter" - "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:) def process_result(result:, field:)
case result[:errors].keys.first case result[:errors].keys.first
when :smtp 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 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 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 end
end end

View file

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

View file

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

View file

@ -78,7 +78,7 @@ class ContactTest < ActiveSupport::TestCase
contact = valid_contact contact = valid_contact
contact.email = 'somecrude1337joke@internet.ee' contact.email = 'somecrude1337joke@internet.ee'
assert contact.invalid? 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 end
def test_email_verification_mx_error def test_email_verification_mx_error
@ -87,7 +87,7 @@ class ContactTest < ActiveSupport::TestCase
contact = valid_contact contact = valid_contact
contact.email = 'somecrude31337joke@somestrange31337domain.ee' contact.email = 'somecrude31337joke@somestrange31337domain.ee'
assert contact.invalid? 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 end
def test_email_verification_regex_error def test_email_verification_regex_error
@ -96,7 +96,7 @@ class ContactTest < ActiveSupport::TestCase
contact = valid_contact contact = valid_contact
contact.email = 'some@strangesentence@internet.ee' contact.email = 'some@strangesentence@internet.ee'
assert contact.invalid? 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 end
def test_invalid_without_phone def test_invalid_without_phone

View file

@ -56,7 +56,7 @@ class RegistrarTest < ActiveSupport::TestCase
registrar.billing_email = nil registrar.billing_email = nil
assert registrar.invalid? 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 end
def test_email_verification_mx_error def test_email_verification_mx_error
@ -67,7 +67,7 @@ class RegistrarTest < ActiveSupport::TestCase
registrar.billing_email = nil registrar.billing_email = nil
assert registrar.invalid? 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 end
def test_email_verification_regex_error def test_email_verification_regex_error
@ -78,7 +78,7 @@ class RegistrarTest < ActiveSupport::TestCase
registrar.billing_email = nil registrar.billing_email = nil
assert registrar.invalid? 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 end
def test_billing_email_verification_valid def test_billing_email_verification_valid
@ -95,7 +95,7 @@ class RegistrarTest < ActiveSupport::TestCase
registrar.billing_email = 'somecrude1337joke@internet.ee' registrar.billing_email = 'somecrude1337joke@internet.ee'
assert registrar.invalid? 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 end
def test_billing_email_verification_mx_error def test_billing_email_verification_mx_error
@ -105,7 +105,7 @@ class RegistrarTest < ActiveSupport::TestCase
registrar.billing_email = 'somecrude31337joke@somestrange31337domain.ee' registrar.billing_email = 'somecrude31337joke@somestrange31337domain.ee'
assert registrar.invalid? 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 end
def test_billing_email_verification_regex_error def test_billing_email_verification_regex_error
@ -115,7 +115,7 @@ class RegistrarTest < ActiveSupport::TestCase
registrar.billing_email = 'some@strangesentence@internet.ee' registrar.billing_email = 'some@strangesentence@internet.ee'
assert registrar.invalid? 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 end
def test_creates_email_verification_in_unicode def test_creates_email_verification_in_unicode