Add test to see if registrant verification stores versions

This commit is contained in:
Alex Sherman 2020-01-14 18:47:24 +05:00
parent 844e613ee1
commit d95081adcf
2 changed files with 23 additions and 0 deletions

View file

@ -27,6 +27,8 @@ Rails.application.configure do
# ActionMailer::Base.deliveries array. # ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test config.action_mailer.delivery_method = :test
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the stderr. # Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr config.active_support.deprecation = :stderr

View file

@ -1,6 +1,16 @@
require 'test_helper' require 'test_helper'
class RegistrantVerificationTest < ActiveSupport::TestCase class RegistrantVerificationTest < ActiveSupport::TestCase
setup do
@domain = domains(:shop)
@initiator = users(:api_bestnames).username
@token = 'zzzzz'
@domain.update(statuses: [DomainStatus::PENDING_UPDATE],
registrant_verification_asked_at: Time.zone.now - 1.day,
registrant_verification_token: @token)
end
def test_audit_log def test_audit_log
registrant_verification = registrant_verifications(:one) registrant_verification = registrant_verifications(:one)
random_action = "random#{rand(100)}" random_action = "random#{rand(100)}"
@ -9,4 +19,15 @@ class RegistrantVerificationTest < ActiveSupport::TestCase
registrant_verification.update_attributes!(action: random_action) registrant_verification.update_attributes!(action: random_action)
end end
end end
def test_reject_changes
@registrant_verification = RegistrantVerification.new(domain_id: @domain.id,
verification_token: @token)
start_versions_count = RegistrantVerificationVersion.count
assert_nothing_raised do
@registrant_verification.domain_registrant_change_reject!("email link, #{@initiator}")
end
assert_equal RegistrantVerificationVersion.count, start_versions_count + 1
end
end end