Skip to content

Commit b1465f3

Browse files
committed
Check 192 address is private in CI
1 parent c63ed77 commit b1465f3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

test/models/profile_test.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,17 @@ class ProfileTest < ActiveSupport::TestCase
8282
refute profile.errors.added?(:website, 'is blocked')
8383

8484
# private address is not OK
85-
with_net_connection do # Allow request through to be caught by private_address_check
85+
WebMock.allow_net_connect!
86+
assert PrivateAddressCheck.resolves_to_private_address?('192.168.0.1')
87+
VCR.turned_off do
8688
refute profile.update(website: 'http://192.168.0.1')
8789
assert profile.errors.added?(:website, 'is not accessible')
8890
end
8991

9092
# address that times out is OK
9193
assert profile.update(website: 'http://slowhost.com')
9294
refute profile.errors.added?(:website, 'is not accessible')
95+
ensure
96+
WebMock.disable_net_connect!(allow_localhost: true)
9397
end
9498
end

0 commit comments

Comments
 (0)