mirror of
https://github.com/internetee/registry.git
synced 2025-08-01 23:42:04 +02:00
parent
787cca8e4c
commit
35afbf1f8c
15 changed files with 304 additions and 54 deletions
42
spec/features/registrar/sessions/new_spec.rb
Normal file
42
spec/features/registrar/sessions/new_spec.rb
Normal file
|
@ -0,0 +1,42 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.feature 'Registrar area ip restriction', settings: false do
|
||||
context 'when enabled' do
|
||||
background do
|
||||
Setting.registrar_ip_whitelist_enabled = true
|
||||
end
|
||||
|
||||
context 'when ip is allowed' do
|
||||
given!(:white_ip) { create(:white_ip,
|
||||
ipv4: '127.0.0.1',
|
||||
interfaces: [WhiteIp::REGISTRAR]) }
|
||||
|
||||
it 'does not show error message' do
|
||||
visit registrar_login_path
|
||||
expect(page).to_not have_text(error_message)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when ip is not allowed' do
|
||||
it 'shows error message' do
|
||||
visit registrar_login_path
|
||||
expect(page).to have_text(error_message)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when disabled' do
|
||||
background do
|
||||
Setting.registrar_ip_whitelist_enabled = false
|
||||
end
|
||||
|
||||
it 'does not show error message' do
|
||||
visit registrar_login_path
|
||||
expect(page).to_not have_text(error_message)
|
||||
end
|
||||
end
|
||||
|
||||
def error_message
|
||||
t('registrar.authorization.ip_not_allowed', ip: '127.0.0.1')
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue