Merge branch 'master' into registry-623

# Conflicts:
#	test/integration/admin/registrars/show_registrar_test.rb
This commit is contained in:
Artur Beljajev 2018-04-12 17:16:58 +03:00
commit 7ffc62e370
34 changed files with 72 additions and 44 deletions

View file

@ -37,7 +37,7 @@
= f.email_field :bcc, class: 'form-control'
.form-group
.col-md-12
= f.label :body, t(:html_body)
= f.label :body, t('admin.mail_templates.html_body')
= liquid_help
.col-md-12
= f.text_area(:body, class: 'form-control', size: '15x15')

View file

@ -1,3 +1,3 @@
= render 'shared/title', name: t(:new_mail_template)
= render 'shared/title', name: t('admin.mail_templates.new_mail_template')
= render 'form', mail_template: @mail_template

View file

@ -43,6 +43,7 @@ Rails.application.configure do
config.log_level = :debug
config.active_job.queue_adapter = :test
config.logger = ActiveSupport::Logger.new(nil)
config.active_support.test_order = :random # :random is the default in Rails 5
end
# In this mode, any jobs you queue will be run in the same thread, synchronously

View file

@ -0,0 +1,5 @@
en:
admin:
mail_templates:
html_body: HTML body
new_mail_template: New mail template

View file

@ -729,7 +729,6 @@ en:
is_registrant: 'Is registrant'
force_delete_set_on_domain: 'Force delete set on domain %{domain_name}'
mail_templates: Mail Templates
new_mail_template: New mail template
failure: "It was not saved"
contact_is_not_valid: 'Contact %{value} is not valid, please fix the invalid contact'
welcome_to_eis_registrar_portal: 'Welcome to EIS Registrar portal'

View file

@ -3,7 +3,7 @@ require 'test_helper'
class AdminAreaDomainForceDeleteTest < ActionDispatch::IntegrationTest
include ActionMailer::TestHelper
def setup
setup do
login_as users(:admin)
@domain = domains(:shop)
ActionMailer::Base.deliveries.clear

View file

@ -1,7 +1,7 @@
require 'test_helper'
class AdminDomainsTestTest < ActionDispatch::IntegrationTest
def setup
setup do
login_as users(:admin)
end

View file

@ -0,0 +1,14 @@
require 'test_helper'
class AdminAreaNewMailTemplateTest < ActionDispatch::IntegrationTest
def setup
login_as users(:admin)
end
def test_new_mail_template_does_not_throw_template_error
visit admin_mail_templates_url
click_link_or_button 'New'
assert_text "HTML body"
assert_text "New mail template"
end
end

View file

@ -1,7 +1,7 @@
require 'test_helper'
class AdminAreaDeleteRegistrarTest < ActionDispatch::IntegrationTest
def setup
setup do
login_as users(:admin)
end

View file

@ -1,7 +1,7 @@
require 'test_helper'
class AdminAreaEditRegistrarTest < ActionDispatch::IntegrationTest
def setup
setup do
login_as users(:admin)
@registrar = registrars(:bestnames)
end

View file

@ -1,7 +1,7 @@
require 'test_helper'
class AdminAreaNewRegistrarTest < ActionDispatch::IntegrationTest
def setup
setup do
login_as users(:admin)
end

View file

@ -1,7 +1,7 @@
require 'test_helper'
class APIDomainTransfersTest < ActionDispatch::IntegrationTest
def setup
setup do
@domain = domains(:shop)
@new_registrar = registrars(:goodnames)
Setting.transfer_wait_time = 0 # Auto-approval

View file

@ -1,7 +1,7 @@
require 'test_helper'
class EppDomainCreateTransferCodeTest < ActionDispatch::IntegrationTest
def setup
setup do
travel_to Time.zone.parse('2010-07-05')
end

View file

@ -3,7 +3,7 @@ require 'test_helper'
class EppDomainRenewTest < ActionDispatch::IntegrationTest
self.use_transactional_fixtures = false
def setup
setup do
travel_to Time.zone.parse('2010-07-05')
end

View file

@ -1,7 +1,7 @@
require 'test_helper'
class EppDomainTransferRequestTest < ActionDispatch::IntegrationTest
def setup
setup do
@domain = domains(:shop)
@new_registrar = registrars(:goodnames)
Setting.transfer_wait_time = 0

View file

@ -1,7 +1,7 @@
require 'test_helper'
class EppLoginSessionLimitTest < ActionDispatch::IntegrationTest
def setup
setup do
travel_to Time.zone.parse('2010-07-05')
EppSession.delete_all
end

View file

@ -1,7 +1,7 @@
require 'test_helper'
class RegistrantDomainsTest < ActionDispatch::IntegrationTest
def setup
setup do
login_as users(:registrant)
Setting.days_to_keep_business_registry_cache = 1

View file

@ -1,7 +1,7 @@
require 'test_helper'
class RegistrarDomainTransfersTest < ActionDispatch::IntegrationTest
def setup
setup do
WebMock.reset!
login_as users(:api_goodnames)
end

View file

@ -1,7 +1,7 @@
require 'test_helper'
class RegistrarNameserverReplacementTest < ActionDispatch::IntegrationTest
def setup
setup do
WebMock.reset!
login_as users(:api_goodnames)
end

View file

@ -1,7 +1,7 @@
require 'test_helper'
class ContactTest < ActiveSupport::TestCase
def setup
setup do
@contact = contacts(:john)
end

View file

@ -12,11 +12,16 @@ class ContactIdenticalTest < ActiveSupport::TestCase
org_name
]
def setup
setup do
@original_address_processing = Setting.address_processing
@contact = contacts(:william)
@identical = contacts(:identical_to_william)
end
teardown do
Setting.address_processing = @original_address_processing
end
def test_returns_identical
assert_equal @identical, @contact.identical(@identical.registrar)
end
@ -33,30 +38,24 @@ class ContactIdenticalTest < ActiveSupport::TestCase
assert_nil @contact.identical(@identical.registrar)
end
def test_takes_address_into_account_when_processing_enabled
def test_takes_address_into_account_when_address_processing_is_on
Setting.address_processing = true
Contact.address_attribute_names.each do |attribute|
previous_value = @identical.public_send(attribute)
@identical.update_attribute(attribute, 'other')
Contact.stub :address_processing?, true do
assert_nil @contact.identical(@identical.registrar)
end
assert_nil @contact.identical(@identical.registrar)
@identical.update_attribute(attribute, previous_value)
end
end
def test_ignores_address_when_processing_disabled
def test_ignores_address_when_address_processing_is_off
Setting.address_processing = false
Contact.address_attribute_names.each do |attribute|
previous_value = @identical.public_send(attribute)
@identical.update_attribute(attribute, 'other')
Contact.stub :address_processing?, false do
assert_equal @identical, @contact.identical(@identical.registrar)
end
assert_equal @identical, @contact.identical(@identical.registrar)
@identical.update_attribute(attribute, previous_value)
end
end

View file

@ -1,10 +1,15 @@
require 'test_helper'
class ContactPostalAddressTest < ActiveSupport::TestCase
def setup
setup do
@original_address_processing = Setting.address_processing
@contact = contacts(:john)
end
teardown do
Setting.address_processing = @original_address_processing
end
def test_invalid_if_country_code_is_invalid_and_address_processing_is_on
Setting.address_processing = true
@contact.country_code = 'invalid'

View file

@ -1,7 +1,7 @@
require 'test_helper'
class ContactTransferTest < ActiveSupport::TestCase
def setup
setup do
@contact = contacts(:john)
@new_registrar = registrars(:goodnames)
end

View file

@ -1,7 +1,7 @@
require 'test_helper'
class DomainTest < ActiveSupport::TestCase
def setup
setup do
@domain = domains(:shop)
end

View file

@ -1,7 +1,7 @@
require 'test_helper'
class DomainTransferableTest < ActiveSupport::TestCase
def setup
setup do
@domain = domains(:shop)
@new_registrar = registrars(:goodnames)
end

View file

@ -1,7 +1,7 @@
require 'test_helper'
class DomainTransferTest < ActiveSupport::TestCase
def setup
setup do
@domain_transfer = domain_transfers(:shop)
end

View file

@ -1,7 +1,7 @@
require 'test_helper'
class EppSessionTest < ActiveSupport::TestCase
def setup
setup do
@epp_session = epp_sessions(:api_bestnames)
end

View file

@ -1,7 +1,7 @@
require 'test_helper'
class MessageTest < ActiveSupport::TestCase
def setup
setup do
@message = messages(:greeting)
end

View file

@ -1,7 +1,7 @@
require 'test_helper'
class NameserverGlueRecordTest < ActiveSupport::TestCase
def setup
setup do
@nameserver = nameservers(:shop_ns1)
end

View file

@ -1,7 +1,7 @@
require 'test_helper'
class NameserverTest < ActiveSupport::TestCase
def setup
setup do
@nameserver = nameservers(:shop_ns1)
end

View file

@ -1,7 +1,7 @@
require 'test_helper'
class RegistrarCodeTest < ActiveSupport::TestCase
def setup
setup do
@registrar = registrars(:bestnames).dup
end

View file

@ -1,7 +1,7 @@
require 'test_helper'
class DeleteRegistrarTest < ActiveSupport::TestCase
def setup
setup do
@registrar = registrars(:not_in_use)
end

View file

@ -1,7 +1,7 @@
require 'test_helper'
class RegistrarTest < ActiveSupport::TestCase
def setup
setup do
@registrar = registrars(:bestnames)
end

View file

@ -21,6 +21,10 @@ class ActiveSupport::TestCase
ActiveRecord::Migration.check_pending!
fixtures :all
teardown do
travel_back
end
end
class ActionDispatch::IntegrationTest
@ -29,8 +33,9 @@ class ActionDispatch::IntegrationTest
include Capybara::Minitest::Assertions
include AbstractController::Translation
def teardown
teardown do
Warden.test_reset!
WebMock.reset!
Capybara.reset_sessions!
Capybara.use_default_driver
end