ae_network_connection_exception 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d15412b0f4f9d37fc5d9f5d9964689fe9ec590f
|
4
|
+
data.tar.gz: 57dc942fa855395fdee76cdd72116cf070b86fab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dce615eb9c83dfc8f1e8695cd6581bc03d9f4629c90068cc4ad3cc9f31f21c8b778cb570efff2cdc6961c7fef36800cc1a3d5d83c35127754b6b1e0214c510d1
|
7
|
+
data.tar.gz: 2bc44eb8602db36ce550a6f8dc0b6be056793a65942cbf187e4759b4014a7b62e220d888794e5a26d6e36c1d6c0882557f886605e89a4e59577aea8f3f1d4c17
|
@@ -29,6 +29,17 @@ module AeNetworkConnectionException
|
|
29
29
|
raise_if_exception_message_matches(e, /SSL_connect/)
|
30
30
|
end
|
31
31
|
|
32
|
+
# An array of examples for all the exceptions that we will catch
|
33
|
+
def exception_signatures
|
34
|
+
[
|
35
|
+
SocketError.new('getaddrinfo: Name or service not known'),
|
36
|
+
Errno::ECONNREFUSED.new('Connection refused - connect(2) for "example.com" port 443'),
|
37
|
+
Errno::ETIMEDOUT.new('Connection timed out - connect(2) for "example.com" port 443'),
|
38
|
+
Net::OpenTimeout.new('message'),
|
39
|
+
Errno::ECONNRESET.new('Connection reset by peer - SSL_connect')
|
40
|
+
]
|
41
|
+
end
|
42
|
+
|
32
43
|
private
|
33
44
|
|
34
45
|
def raise_if_exception_message_matches(exception, pattern)
|
@@ -38,15 +38,29 @@ module AeNetworkConnectionException
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def test_ae_network_connection_exception_try__raises_connection_not_establised_exception
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
assert_connection_not_established_thrown_for(Net::OpenTimeout.new('message'))
|
45
|
-
assert_connection_not_established_thrown_for(Errno::ECONNRESET.new('Connection reset by peer - SSL_connect'))
|
41
|
+
AeNetworkConnectionException.exception_signatures.each do |e|
|
42
|
+
assert_connection_not_established_thrown_for(e)
|
43
|
+
end
|
46
44
|
|
47
45
|
assert_connection_not_established_not_thrown_for(Errno::ECONNRESET.new('Connection timed out - connect(2) for "example.com" port 443'))
|
48
46
|
assert_connection_not_established_not_thrown_for(Errno::ETIMEDOUT.new('Connection timed out - recvfrom(2) for "example.com" port 443'))
|
49
47
|
end
|
48
|
+
|
49
|
+
def test_exception_signatures
|
50
|
+
expected_signatures = [
|
51
|
+
SocketError.new('getaddrinfo: Name or service not known'),
|
52
|
+
Errno::ECONNREFUSED.new('Connection refused - connect(2) for "example.com" port 443'),
|
53
|
+
Errno::ETIMEDOUT.new('Connection timed out - connect(2) for "example.com" port 443'),
|
54
|
+
Net::OpenTimeout.new('message'),
|
55
|
+
Errno::ECONNRESET.new('Connection reset by peer - SSL_connect')
|
56
|
+
]
|
57
|
+
|
58
|
+
assert_equal expected_signatures.size, AeNetworkConnectionException.exception_signatures.size
|
59
|
+
|
60
|
+
expected_signatures.each do |e|
|
61
|
+
assert_includes AeNetworkConnectionException.exception_signatures, e
|
62
|
+
end
|
63
|
+
end
|
50
64
|
|
51
65
|
private
|
52
66
|
|