rescue-me 1.0.1.pre → 1.0.1.pre2
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.
- data/lib/rescue-me.rb +1 -1
- data/lib/rescue_me/version.rb +1 -1
- data/spec/lib/rescue-me_spec.rb +29 -18
- metadata +2 -2
data/lib/rescue-me.rb
CHANGED
@@ -36,7 +36,7 @@ module RescueMe
|
|
36
36
|
|
37
37
|
if defined? ActiveResource::ConnectionError
|
38
38
|
err.delete(Timeout::Error)
|
39
|
-
err
|
39
|
+
err += [ActiveResource::TimeoutError, ActiveResource::SSLError, ActiveResource::ServerError]
|
40
40
|
end
|
41
41
|
|
42
42
|
err
|
data/lib/rescue_me/version.rb
CHANGED
data/spec/lib/rescue-me_spec.rb
CHANGED
@@ -24,7 +24,7 @@ describe RescueMe do
|
|
24
24
|
class Error; end
|
25
25
|
end
|
26
26
|
|
27
|
-
subject.net_http_errors.include
|
27
|
+
subject.net_http_errors.should include(Net::HTTP::Persistent::Error)
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'should not include Net::HTTP:Persistent::Error if that library is not defined' do
|
@@ -35,7 +35,7 @@ describe RescueMe do
|
|
35
35
|
class Error; end
|
36
36
|
end
|
37
37
|
|
38
|
-
errors.include
|
38
|
+
errors.should_not include(Net::HTTP::Persistent::Error)
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'should include OpenSSL::SSL::SSLError if that library is defined' do
|
@@ -44,7 +44,7 @@ describe RescueMe do
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
subject.net_http_errors.include
|
47
|
+
subject.net_http_errors.should include(OpenSSL::SSL::SSLError)
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'should not include OpenSSL::SSL::SSLError if that library is not defined' do
|
@@ -53,37 +53,48 @@ describe RescueMe do
|
|
53
53
|
class OpenSSL::SSL::SSLError < StandardError
|
54
54
|
end
|
55
55
|
|
56
|
-
errors.include
|
56
|
+
errors.should_not include(OpenSSL::SSL::SSLError)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
60
|
describe '.active_resource_errors' do
|
61
61
|
before :each do
|
62
62
|
ActiveResource.send(:remove_const, :ConnectionError) if defined? ActiveResource::ConnectionError
|
63
|
+
ActiveResource.send(:remove_const, :TimeoutError) if defined? ActiveResource::TimeoutError
|
64
|
+
ActiveResource.send(:remove_const, :SSLError) if defined? ActiveResource::SSLError
|
65
|
+
ActiveResource.send(:remove_const, :ServerError) if defined? ActiveResource::ServerError
|
63
66
|
end
|
64
67
|
|
65
68
|
it 'should return a list of errors' do
|
66
69
|
should_return_a_list_of_errors(:active_resource_errors)
|
67
70
|
end
|
68
71
|
|
69
|
-
it 'should include ActiveResource::ConnectionError if it is defined' do
|
72
|
+
it 'should include ActiveResource::ConnectionError decendents if it is defined' do
|
70
73
|
class ActiveResource
|
71
74
|
class ConnectionError
|
72
75
|
end
|
76
|
+
|
77
|
+
class TimeoutError < ConnectionError; end
|
78
|
+
class SSLError < ConnectionError; end
|
79
|
+
class ServerError < ConnectionError; end
|
73
80
|
end
|
74
81
|
|
75
|
-
subject.active_resource_errors.include
|
82
|
+
subject.active_resource_errors.should include(ActiveResource::TimeoutError, ActiveResource::SSLError, ActiveResource::ServerError)
|
76
83
|
end
|
77
84
|
|
78
|
-
it 'should not include ActiveResource::ConnectionError if it is not defined' do
|
85
|
+
it 'should not include ActiveResource::ConnectionError decendents if it is not defined' do
|
79
86
|
errors = subject.active_resource_errors
|
80
87
|
|
81
88
|
class ActiveResource
|
82
89
|
class ConnectionError
|
83
90
|
end
|
91
|
+
|
92
|
+
class TimeoutError < ConnectionError; end
|
93
|
+
class SSLError < ConnectionError; end
|
94
|
+
class ServerError < ConnectionError; end
|
84
95
|
end
|
85
96
|
|
86
|
-
errors.include
|
97
|
+
errors.should_not include(ActiveResource::TimeoutError, ActiveResource::SSLError, ActiveResource::ServerError)
|
87
98
|
end
|
88
99
|
end
|
89
100
|
|
@@ -93,11 +104,11 @@ describe RescueMe do
|
|
93
104
|
end
|
94
105
|
|
95
106
|
it 'should include Net::SMTPAuthenticationError' do
|
96
|
-
subject.net_smtp_server_errors.include
|
107
|
+
subject.net_smtp_server_errors.should include(Net::SMTPAuthenticationError)
|
97
108
|
end
|
98
109
|
|
99
110
|
it 'should not include Net::SMTPAuthenticationError when disabled' do
|
100
|
-
subject.net_smtp_server_errors(:with_auth => false).include
|
111
|
+
subject.net_smtp_server_errors(:with_auth => false).should_not include(Net::SMTPAuthenticationError)
|
101
112
|
end
|
102
113
|
end
|
103
114
|
|
@@ -107,10 +118,10 @@ describe RescueMe do
|
|
107
118
|
end
|
108
119
|
|
109
120
|
it 'should not include Net::SMTPAuthenticationError' do
|
110
|
-
subject.net_smtp_client_errors.include
|
121
|
+
subject.net_smtp_client_errors.should_not include(Net::SMTPAuthenticationError)
|
111
122
|
end
|
112
123
|
it 'should include Net::SMTPAuthenticationError when enabled' do
|
113
|
-
subject.net_smtp_client_errors(:with_auth => true).include
|
124
|
+
subject.net_smtp_client_errors(:with_auth => true).should include(Net::SMTPAuthenticationError)
|
114
125
|
end
|
115
126
|
end
|
116
127
|
|
@@ -138,22 +149,22 @@ describe RescueMe do
|
|
138
149
|
errors = subject.send(:errors_with, :errors, test_ary)
|
139
150
|
|
140
151
|
test_ary.each do |a|
|
141
|
-
errors.include
|
152
|
+
errors.should include(a)
|
142
153
|
end
|
143
154
|
end
|
144
155
|
|
145
156
|
it 'should have the original elements' do
|
146
|
-
subject.send(:errors_with, :errors, [FooError, BarError]).include
|
157
|
+
subject.send(:errors_with, :errors, [FooError, BarError]).should include(OrigError)
|
147
158
|
end
|
148
159
|
end
|
149
160
|
|
150
161
|
context 'a single exception' do
|
151
162
|
it 'should add the exception' do
|
152
|
-
subject.send(:errors_with, :errors, FooError).include
|
163
|
+
subject.send(:errors_with, :errors, FooError).should include(FooError)
|
153
164
|
end
|
154
165
|
|
155
166
|
it 'should have the original elements' do
|
156
|
-
subject.send(:errors_with, :errors, FooError).include
|
167
|
+
subject.send(:errors_with, :errors, FooError).should include(OrigError)
|
157
168
|
end
|
158
169
|
end
|
159
170
|
|
@@ -164,12 +175,12 @@ describe RescueMe do
|
|
164
175
|
errors = subject.send(:errors_with, :errors, set)
|
165
176
|
|
166
177
|
set.each do |s|
|
167
|
-
errors.include
|
178
|
+
errors.should include(s)
|
168
179
|
end
|
169
180
|
end
|
170
181
|
|
171
182
|
it 'should have the original elements' do
|
172
|
-
errors = subject.send(:errors_with, :errors, set).include
|
183
|
+
errors = subject.send(:errors_with, :errors, set).should include(OrigError)
|
173
184
|
end
|
174
185
|
end
|
175
186
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rescue-me
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.1.
|
4
|
+
version: 1.0.1.pre2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -125,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
segments:
|
127
127
|
- 0
|
128
|
-
hash:
|
128
|
+
hash: 540034423581166621
|
129
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
130
|
none: false
|
131
131
|
requirements:
|