internetee-registry/test/integration/registrar_area/settings/balance_auto_reload_test.rb
Artur Beljajev fa52001be6 Upgrade to Rails 5.0
Closes #377
2019-11-15 15:26:33 +02:00

32 lines
No EOL
1.1 KiB
Ruby

require 'test_helper'
class RegistrarAreaSettingsBalanceAutoReloadIntegrationTest < ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers
setup do
@registrar = registrars(:bestnames)
sign_in users(:api_bestnames)
end
def test_updates_balance_auto_reload_setting
amount = 100
threshold = 10
assert_nil @registrar.settings['balance_auto_reload']
patch registrar_settings_balance_auto_reload_path, params: { type: { amount: amount,
threshold: threshold } }
@registrar.reload
assert_equal amount, @registrar.settings['balance_auto_reload']['type']['amount']
assert_equal threshold, @registrar.settings['balance_auto_reload']['type']['threshold']
end
def test_disables_balance_auto_reload_setting
@registrar.update!(settings: { balance_auto_reload: { amount: 'any', threshold: 'any' } })
delete registrar_settings_balance_auto_reload_path
@registrar.reload
assert_nil @registrar.settings['balance_auto_reload']
end
end