sidekiq-configure_notifications 0.0.3 → 0.0.4
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: 6fa7d57263da4d6407bc7df715222530129fbc27
|
4
|
+
data.tar.gz: e2157492f3d5a3705b49e0d76b6032bd45402806
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9beed690778948d179b8b6a4a4c00e5e4541a747ac6653608f03e30a39e3ca464400a6c938d8cb027ad65fba29ce3c705a31f01a8c910baad850474a86ea0179
|
7
|
+
data.tar.gz: 8090334f5613cab1f9ffbbf2ef70ee09ba2e14d66cf09e580f73197b91efb750ae95f7b071a40e2e711d15ed5e52dacc65fe04a12a292943e78e8c81675a214a
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_dependency 'sidekiq', '~> 2.
|
22
|
+
spec.add_dependency 'sidekiq', '~> 3.2.5'
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
25
25
|
spec.add_development_dependency "rake"
|
@@ -2,8 +2,6 @@ require 'helper'
|
|
2
2
|
require 'sidekiq'
|
3
3
|
require 'sidekiq/exception_handler'
|
4
4
|
require 'sidekiq/configure_notifications/exception_handler'
|
5
|
-
require 'stringio'
|
6
|
-
require 'logger'
|
7
5
|
|
8
6
|
ExceptionHandlerTestException = Class.new(StandardError)
|
9
7
|
TEST_EXCEPTION = ExceptionHandlerTestException.new("Something didn't work!")
|
@@ -20,55 +18,53 @@ end
|
|
20
18
|
|
21
19
|
class TestExceptionHandler < Minitest::Test
|
22
20
|
describe "with log_exceptions_after and skip_log_exceptions options" do
|
23
|
-
after do
|
24
|
-
Object.send(:remove_const, "Airbrake") # HACK should probably inject Airbrake etc into this class in the future
|
25
|
-
end
|
26
21
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
raise "it should not be called"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
22
|
+
let(:error_handler) { Minitest::Mock.new }
|
23
|
+
|
24
|
+
before { Sidekiq.error_handlers << error_handler }
|
25
|
+
after { Sidekiq.error_handlers.delete error_handler }
|
35
26
|
|
27
|
+
describe "does not log" do
|
36
28
|
it "does not log when number of retries is less than log_exceptions_after" do
|
29
|
+
error_handler.expect :call, nil, [TEST_EXCEPTION, 'log_exceptions_after' => 4, 'retry_count' => 3]
|
37
30
|
Component.new.invoke_exception('log_exceptions_after' => 4, 'retry_count' => 3)
|
31
|
+
assert_raises(MockExpectationError, "It logged!") do
|
32
|
+
error_handler.verify
|
33
|
+
end
|
38
34
|
end
|
39
35
|
|
40
36
|
it "does not log when number of retries is bigger than log_exceptions_after and exception is not in skip_log_exceptions" do
|
37
|
+
error_handler.expect :call, nil, [TEST_EXCEPTION, 'log_exceptions_after' => 2, 'retry_count' => 3, 'skip_log_exceptions' => [::Exception]]
|
41
38
|
Component.new.invoke_exception('log_exceptions_after' => 2, 'retry_count' => 3, 'skip_log_exceptions' => [::Exception])
|
39
|
+
assert_raises(MockExpectationError, "It logged!") do
|
40
|
+
error_handler.verify
|
41
|
+
end
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
describe "logs" do
|
46
|
-
before do
|
47
|
-
::Airbrake = Minitest::Mock.new
|
48
|
-
end
|
49
|
-
|
50
46
|
it "logs when number of retries is less than log_exceptions_after and exception is not in skip_log_exceptions 3" do
|
51
|
-
|
47
|
+
error_handler.expect :call, nil, [TEST_EXCEPTION, { 'log_exceptions_after' => 2, 'retry_count' => 3, 'skip_log_exceptions' => [ExceptionHandlerTestException] }]
|
52
48
|
Component.new.invoke_exception('log_exceptions_after' => 2, 'retry_count' => 3, 'skip_log_exceptions' => [ExceptionHandlerTestException])
|
53
|
-
|
49
|
+
error_handler.verify
|
54
50
|
end
|
55
51
|
|
56
52
|
it "logs when number of retries is less than log_exceptions_after and skip_log_exceptions is empty" do
|
57
|
-
|
53
|
+
error_handler.expect :call, nil, [TEST_EXCEPTION, { 'log_exceptions_after' => 2, 'retry_count' => 3, 'skip_log_exceptions' => [] }]
|
58
54
|
Component.new.invoke_exception('log_exceptions_after' => 2, 'retry_count' => 3, 'skip_log_exceptions' => [])
|
59
|
-
|
55
|
+
error_handler.verify
|
60
56
|
end
|
61
57
|
|
62
58
|
it "logs when number of retries is less than log_exceptions_after and skip_log_exceptions is not given" do
|
63
|
-
|
59
|
+
error_handler.expect :call, nil, [TEST_EXCEPTION, { 'log_exceptions_after' => 2, 'retry_count' => 3 }]
|
64
60
|
Component.new.invoke_exception('log_exceptions_after' => 2, 'retry_count' => 3)
|
65
|
-
|
61
|
+
error_handler.verify
|
66
62
|
end
|
67
63
|
|
68
64
|
it "logs when log_exceptions_after is not given" do
|
69
|
-
|
65
|
+
error_handler.expect :call, nil, [TEST_EXCEPTION, {}]
|
70
66
|
Component.new.invoke_exception({})
|
71
|
-
|
67
|
+
error_handler.verify
|
72
68
|
end
|
73
69
|
end
|
74
70
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-configure_notifications
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caue Guerra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 3.2.5
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 3.2.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|