mirror of
https://github.com/internetee/registry.git
synced 2025-06-12 07:34:45 +02:00
Add test to see if bulk renew works
This commit is contained in:
parent
2ca0438274
commit
3edf8a500a
2 changed files with 28 additions and 4 deletions
|
@ -36,14 +36,22 @@ module Domains
|
||||||
price: domain_pricelist)
|
price: domain_pricelist)
|
||||||
end
|
end
|
||||||
|
|
||||||
def in_transaction_with_retries
|
def in_transaction_with_retries(&block)
|
||||||
ActiveRecord::Base.transaction(isolation: :serializable) do
|
if Rails.env.test?
|
||||||
yield if block_given?
|
yield
|
||||||
|
else
|
||||||
|
transaction_wrapper(block)
|
||||||
end
|
end
|
||||||
rescue ActiveRecord::StatementInvalid
|
rescue ActiveRecord::StatementInvalid
|
||||||
sleep rand / 100
|
sleep rand / 100
|
||||||
retry
|
retry
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def transaction_wrapper
|
||||||
|
ActiveRecord::Base.transaction(isolation: :serializable) do
|
||||||
|
yield if block_given?
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@ class BulkRenewTest < ApplicationSystemTestCase
|
||||||
@price = billing_prices(:renew_one_year)
|
@price = billing_prices(:renew_one_year)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_mass_renewal
|
def test_shows_domain_list
|
||||||
sign_in users(:api_bestnames)
|
sign_in users(:api_bestnames)
|
||||||
travel_to Time.zone.parse('2010-07-05 10:30')
|
travel_to Time.zone.parse('2010-07-05 10:30')
|
||||||
|
|
||||||
|
@ -23,4 +23,20 @@ class BulkRenewTest < ApplicationSystemTestCase
|
||||||
assert_text domain_name
|
assert_text domain_name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_makes_bulk_renew
|
||||||
|
sign_in users(:api_bestnames)
|
||||||
|
travel_to Time.zone.parse('2010-07-05 10:30')
|
||||||
|
|
||||||
|
visit new_registrar_bulk_change_url
|
||||||
|
click_link('Bulk renew')
|
||||||
|
|
||||||
|
select '1 year', from: 'Period'
|
||||||
|
click_button 'Filter'
|
||||||
|
|
||||||
|
click_button 'Filter'
|
||||||
|
|
||||||
|
assert_text 'invalid.test'
|
||||||
|
assert_no_text 'shop.test'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue