test/legitbot/validators/ip_ranges_test.rb in legitbot-1.0.0 vs test/legitbot/validators/ip_ranges_test.rb in legitbot-1.0.1
- old
+ new
@@ -44,10 +44,15 @@
def initialize(ip)
@ip = ip
end
end
+ class NilRanges
+ include IpRanges
+ ip_ranges { nil }
+ end
+
class IpRangesTest < Minitest::Test
def test_partition_method
empty = NoRanges.partition_ips([])
assert_empty empty
end
@@ -106,8 +111,12 @@
refute LoadRanges.new('10.10.10.10').valid_ip?
assert LoadRanges.new('192.168.127.254').valid_ip?
assert_equal 2, LoadRanges.counter
end
# rubocop:enable Metrics/AbcSize
+
+ def test_nil_ranges
+ assert NilRanges.valid_ip?('127.0.0.1')
+ end
end
end
end