mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 13:15:40 +02:00
Bypass validation
This commit is contained in:
parent
5256129849
commit
2997ece103
2 changed files with 12 additions and 3 deletions
|
@ -6,9 +6,7 @@ namespace :data_migrations do
|
|||
Registrar.all.each do |registrar|
|
||||
next unless registrar.reference_no.start_with?('RF')
|
||||
|
||||
registrar.reference_no = Billing::ReferenceNo.generate
|
||||
registrar.save!
|
||||
|
||||
registrar.update_columns(reference_no: Billing::ReferenceNo.generate)
|
||||
processed_registrar_count += 1
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,6 +11,17 @@ class RegenerateRegistrarReferenceNumbersTaskTest < ActiveSupport::TestCase
|
|||
assert_not registrar.reference_no.start_with?('RF')
|
||||
end
|
||||
|
||||
def test_bypasses_registrar_validation
|
||||
registrar = registrars(:invalid)
|
||||
registrar.update_column(:reference_no, 'RF1111')
|
||||
assert registrar.invalid?
|
||||
|
||||
capture_io { run_task }
|
||||
registrar.reload
|
||||
|
||||
assert_not registrar.reference_no.start_with?('RF')
|
||||
end
|
||||
|
||||
def test_does_not_regenerate_when_the_task_is_run_again
|
||||
registrar = registrars(:bestnames)
|
||||
registrar.update!(reference_no: '1111')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue