Refactor EPP session limit

#700
This commit is contained in:
Artur Beljajev 2018-02-14 04:06:13 +02:00
parent 93055acb3a
commit 9b4aa478bf
4 changed files with 90 additions and 9 deletions

View file

@ -43,4 +43,21 @@ class EppSessionTest < ActiveSupport::TestCase
@epp_session.save(validate: false)
end
end
def test_limit_per_registrar
assert_equal 4, EppSession.limit_per_registrar
end
def test_limit_is_per_registrar
travel_to Time.zone.parse('2010-07-05')
EppSession.delete_all
EppSession.limit_per_registrar.times do
EppSession.create!(session_id: SecureRandom.hex,
user: users(:api_goodnames),
updated_at: Time.zone.parse('2010-07-05'))
end
refute EppSession.limit_reached?(registrars(:bestnames))
end
end