Remove occurrencies of Setting.x

This commit is contained in:
Karl Erik Õunapuu 2020-08-12 11:45:51 +03:00
parent 4c9fc76283
commit 49f11cce0b
4 changed files with 5 additions and 11 deletions

View file

@ -8,7 +8,7 @@ module Concerns
end
def legaldoc_not_mandatory?
setting = Setting.find_by(var: 'legal_document_is_mandatory')&.value
setting = Setting.legal_document_is_mandatory
legaldoc_optout || !setting
end
end

View file

@ -1,9 +1,11 @@
class AddLegalDocumentMandatorySetting < ActiveRecord::Migration[6.0]
def up
Setting.legal_document_is_mandatory = true
Setting.create(code: 'legal_document_is_mandatory',
value: 'true', format: 'boolean',
group: 'domain_validation')
end
def down
Setting.find_by(var: 'legal_document_is_mandatory').delete
Setting.find_by(code: 'legal_document_is_mandatory').destroy
end
end

View file

@ -3,8 +3,6 @@ require 'test_helper'
class EppDomainCreateBaseTest < EppTestCase
def test_not_registers_domain_without_legaldoc
old_value = Setting.legal_document_is_mandatory
Setting.legal_document_is_mandatory = true
now = Time.zone.parse('2010-07-05')
travel_to now
name = "new.#{dns_zones(:one).origin}"
@ -31,7 +29,6 @@ class EppDomainCreateBaseTest < EppTestCase
end
assert_epp_response :required_parameter_missing
Setting.legal_document_is_mandatory = old_value
end
def test_registers_new_domain_with_required_attributes
@ -121,8 +118,6 @@ class EppDomainCreateBaseTest < EppTestCase
name = "new.#{dns_zones(:one).origin}"
contact = contacts(:john)
registrant = contact.becomes(Registrant)
old_value = Setting.legal_document_is_mandatory
Setting.legal_document_is_mandatory = true
registrar = registrant.registrar
assert registrar.legaldoc_mandatory?
@ -155,8 +150,6 @@ class EppDomainCreateBaseTest < EppTestCase
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
Setting.legal_document_is_mandatory = old_value
end
def test_registers_reserved_domain_with_registration_code

View file

@ -8,7 +8,6 @@ class DirectoInvoiceForwardJobTest < ActiveSupport::TestCase
end
def teardown
Setting.clear_cache
Setting.directo_monthly_number_min = 309901
Setting.directo_monthly_number_max = 309999
Setting.directo_monthly_number_last = 309901