mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 14:44:47 +02:00
Remove specs
This commit is contained in:
parent
68750883f0
commit
54577b530b
127 changed files with 1954 additions and 7197 deletions
54
test/models/white_ip_test.rb
Normal file
54
test/models/white_ip_test.rb
Normal file
|
@ -0,0 +1,54 @@
|
|||
require 'test_helper'
|
||||
|
||||
class WhiteIpTest < ActiveSupport::TestCase
|
||||
def test_either_ipv4_or_ipv6_is_required
|
||||
white_ip = valid_white_ip
|
||||
|
||||
white_ip.ipv4 = ''
|
||||
white_ip.ipv6 = ''
|
||||
assert white_ip.invalid?
|
||||
assert_includes white_ip.errors.full_messages, 'IPv4 or IPv6 must be present'
|
||||
|
||||
white_ip.ipv4 = valid_ipv4
|
||||
white_ip.ipv6 = ''
|
||||
assert white_ip.valid?
|
||||
|
||||
white_ip.ipv4 = ''
|
||||
white_ip.ipv6 = valid_ipv6
|
||||
assert white_ip.valid?
|
||||
end
|
||||
|
||||
def test_validates_ipv4_format
|
||||
white_ip = valid_white_ip
|
||||
|
||||
white_ip.ipv4 = 'invalid'
|
||||
assert white_ip.invalid?
|
||||
|
||||
white_ip.ipv4 = valid_ipv4
|
||||
assert white_ip.valid?
|
||||
end
|
||||
|
||||
def test_validates_ipv6_format
|
||||
white_ip = valid_white_ip
|
||||
|
||||
white_ip.ipv6 = 'invalid'
|
||||
assert white_ip.invalid?
|
||||
|
||||
white_ip.ipv6 = valid_ipv6
|
||||
assert white_ip.valid?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def valid_white_ip
|
||||
white_ips(:one)
|
||||
end
|
||||
|
||||
def valid_ipv4
|
||||
'192.0.2.1'
|
||||
end
|
||||
|
||||
def valid_ipv6
|
||||
'2001:db8::1'
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue