Refactor IP registrar restriction

#600
This commit is contained in:
Artur Beljajev 2017-10-04 01:03:32 +03:00
parent 787cca8e4c
commit 35afbf1f8c
15 changed files with 304 additions and 54 deletions

View file

@ -38,4 +38,32 @@ describe WhiteIp do
end
end
end
describe '#include_ip?' do
context 'when given ip v4 exists' do
before do
create(:white_ip, ipv4: '127.0.0.1')
end
specify do
expect(described_class.include_ip?('127.0.0.1')).to be true
end
end
context 'when given ip v6 exists' do
before do
create(:white_ip, ipv6: '::1')
end
specify do
expect(described_class.include_ip?('::1')).to be true
end
end
context 'when given ip does not exists', db: false do
specify do
expect(described_class.include_ip?('127.0.0.1')).to be false
end
end
end
end