ae_network_connection_exception 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57008730ed008f3e7650a1e544dbdc05a8baebf5
4
- data.tar.gz: dbfe0dc6d6ce931af76f6756de8f1f94aedc16b4
3
+ metadata.gz: 4d15412b0f4f9d37fc5d9f5d9964689fe9ec590f
4
+ data.tar.gz: 57dc942fa855395fdee76cdd72116cf070b86fab
5
5
  SHA512:
6
- metadata.gz: 556c1d3da505100cc80436e88f041016dbf8ea4e708215d179c1c2bfcff064b949df50c1f4bd1714de1649bee03e528693a1a6b2f0b16a784e767bed0c3c9ca9
7
- data.tar.gz: d5b1f855026a713f9c2cfddd1bf3ef8fe8f277f00ddd6199711830c9260bc933fa12db1b5834eecb1890904ec2b2588004729226756bded90f3a5aa488598967
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)
@@ -1,3 +1,3 @@
1
1
  module AeNetworkConnectionException
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -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
- assert_connection_not_established_thrown_for(SocketError.new("getaddrinfo: Name or service not known"))
42
- assert_connection_not_established_thrown_for(Errno::ECONNREFUSED.new('Connection refused - connect(2) for "example.com" port 443'))
43
- assert_connection_not_established_thrown_for(Errno::ETIMEDOUT.new('Connection timed out - connect(2) for "example.com" port 443'))
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ae_network_connection_exception
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Boyd