delayed_job_exception_notifier 0.0.3 → 1.0.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: 458ecb46a4d1d931e494c20da6ffa03b1c213652
4
- data.tar.gz: 2e897df9a8246a32caf95e58b2d704fc98cbbcaf
3
+ metadata.gz: f4ed17a1fd09fbd12437b03bf60110d2acd8a6e2
4
+ data.tar.gz: b9cb25d360b88d4a4f80ce1a84aa6cc04b37b1f5
5
5
  SHA512:
6
- metadata.gz: ad936836513faf152ada3c76250e8fb213dc58a67aa73af9a1a1e040b28285c7974d1a21bf43b043560e1e6d7299069df11a56b7a72c1fb69d82d2f5cd835e1f
7
- data.tar.gz: 8b3e48973a169a2f69f54575f47ce325161c9157dca5dc7b18f331b90df30a70cc04881927a77d9ea2b0d1a3a6857301542cbacb3257a0226256918591e0a2cc
6
+ metadata.gz: 21dc3f05965a81916d374758dca1a5a1ac8693dbfddfc0a50082d1b7245b5ad15663c7e4bb2272cc05e654b7f9125df59a943d634442025e56ee5db80b0eefbb
7
+ data.tar.gz: 34b997e416959eadef9f57edf3fe0fb511541bc845beade6b91157824161eee0c827b94468a4e1bf0bab9c99b16ada57c299bd4b96c50e0208eb1e0015679879
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --warnings
3
+ --require spec_helper
@@ -20,6 +20,8 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
- spec.add_development_dependency "delayed_job", "3.0.5"
24
- spec.add_development_dependency "exception_notification", "3.0.1"
23
+ spec.add_development_dependency "rspec"
24
+
25
+ spec.add_runtime_dependency "delayed_job", "~> 4"
26
+ spec.add_runtime_dependency "exception_notification", "~> 4.0"
25
27
  end
@@ -0,0 +1,22 @@
1
+ module Delayed
2
+ module Backend
3
+ module Dummy
4
+ class Job
5
+ include Delayed::Backend::Base
6
+
7
+ attr_accessor :priority, :run_at, :queue, :last_error, :attempts, :id,
8
+ :failed_at, :locked_at, :locked_by, :handler
9
+
10
+ def initialize(options)
11
+ @attempts = 0
12
+ @payload_object = options[:payload_object]
13
+ end
14
+
15
+ def destroy
16
+ # puts last_error
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,10 +1,14 @@
1
+ require 'delayed_job'
2
+
1
3
  module Delayed
2
4
  module Plugins
3
5
  class ExceptionNotifier < Plugin
4
6
  module Notify
5
7
  def error(job, exception)
6
- ::ExceptionNotifier::Notifier.background_exception_notification(exception,
7
- :data => { :job_id => job.id, :queue => job.queue }).deliver
8
+ data = {data: { job_id: job.id, queue: job.queue }}
9
+
10
+ ::ExceptionNotifier.notify_exception(exception, data)
11
+
8
12
  super if defined?(super)
9
13
  end
10
14
  end
File without changes
@@ -1,3 +1,3 @@
1
1
  module DelayedJobExceptionNotifier
2
- VERSION = "0.0.3"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+ require 'delayed_job'
3
+ require 'exception_notification'
4
+ require 'delayed_job_exception_notifier'
5
+
6
+ class TestJob
7
+ def perform
8
+ raise StandardError, "Test message"
9
+ end
10
+ end
11
+
12
+ describe DelayedJobExceptionNotifier do
13
+ let(:worker) { Delayed::Worker.new }
14
+ let(:test_job) { Delayed::Job.new payload_object: TestJob.new }
15
+
16
+ it "works" do
17
+ Delayed::Worker.backend = :dummy
18
+ Delayed::Worker.max_attempts = 1
19
+ Delayed::Worker.delay_jobs = false
20
+ Delayed::Worker.plugins << Delayed::Plugins::ExceptionNotifier
21
+ worker.name = "dummy"
22
+
23
+ expect(::ExceptionNotifier).to receive(:notify_exception)
24
+
25
+ worker.run(test_job)
26
+ end
27
+ end
@@ -0,0 +1,78 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
4
+ # file to always be loaded, without a need to explicitly require it in any files.
5
+ #
6
+ # Given that it is always loaded, you are encouraged to keep this file as
7
+ # light-weight as possible. Requiring heavyweight dependencies from this file
8
+ # will add to the boot time of your test suite on EVERY test run, even for an
9
+ # individual file that may not need all of that loaded. Instead, make a
10
+ # separate helper file that requires this one and then use it only in the specs
11
+ # that actually need it.
12
+ #
13
+ # The `.rspec` file also contains a few flags that are not defaults but that
14
+ # users commonly want.
15
+ #
16
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
+ RSpec.configure do |config|
18
+ # The settings below are suggested to provide a good initial experience
19
+ # with RSpec, but feel free to customize to your heart's content.
20
+ =begin
21
+ # These two settings work together to allow you to limit a spec run
22
+ # to individual examples or groups you care about by tagging them with
23
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
24
+ # get run.
25
+ config.filter_run :focus
26
+ config.run_all_when_everything_filtered = true
27
+
28
+ # Many RSpec users commonly either run the entire suite or an individual
29
+ # file, and it's useful to allow more verbose output when running an
30
+ # individual spec file.
31
+ if config.files_to_run.one?
32
+ # Use the documentation formatter for detailed output,
33
+ # unless a formatter has already been configured
34
+ # (e.g. via a command-line flag).
35
+ config.default_formatter = 'doc'
36
+ end
37
+
38
+ # Print the 10 slowest examples and example groups at the
39
+ # end of the spec run, to help surface which specs are running
40
+ # particularly slow.
41
+ config.profile_examples = 10
42
+
43
+ # Run specs in random order to surface order dependencies. If you find an
44
+ # order dependency and want to debug it, you can fix the order by providing
45
+ # the seed, which is printed after each run.
46
+ # --seed 1234
47
+ config.order = :random
48
+
49
+ # Seed global randomization in this process using the `--seed` CLI option.
50
+ # Setting this allows you to use `--seed` to deterministically reproduce
51
+ # test failures related to randomization by passing the same `--seed` value
52
+ # as the one that triggered the failure.
53
+ Kernel.srand config.seed
54
+
55
+ # rspec-expectations config goes here. You can use an alternate
56
+ # assertion/expectation library such as wrong or the stdlib/minitest
57
+ # assertions if you prefer.
58
+ config.expect_with :rspec do |expectations|
59
+ # Enable only the newer, non-monkey-patching expect syntax.
60
+ # For more details, see:
61
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
62
+ expectations.syntax = :expect
63
+ end
64
+
65
+ # rspec-mocks config goes here. You can use an alternate test double
66
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
67
+ config.mock_with :rspec do |mocks|
68
+ # Enable only the newer, non-monkey-patching expect syntax.
69
+ # For more details, see:
70
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
71
+ mocks.syntax = :expect
72
+
73
+ # Prevents you from mocking or stubbing a method that does not exist on
74
+ # a real object. This is generally recommended.
75
+ mocks.verify_partial_doubles = true
76
+ end
77
+ =end
78
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delayed_job_exception_notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitriy Rozhkov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-08 00:00:00.000000000 Z
11
+ date: 2014-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -39,33 +39,47 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: delayed_job
42
+ name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '='
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
- version: 3.0.5
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '='
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
- version: 3.0.5
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: delayed_job
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '4'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '4'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: exception_notification
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - '='
73
+ - - ~>
60
74
  - !ruby/object:Gem::Version
61
- version: 3.0.1
62
- type: :development
75
+ version: '4.0'
76
+ type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - '='
80
+ - - ~>
67
81
  - !ruby/object:Gem::Version
68
- version: 3.0.1
82
+ version: '4.0'
69
83
  description: Plugin for integration ExceptionNotifier with DelayedJob
70
84
  email:
71
85
  - rojkov.dmitry@gmail.com
@@ -74,14 +88,19 @@ extensions: []
74
88
  extra_rdoc_files: []
75
89
  files:
76
90
  - .gitignore
91
+ - .rspec
77
92
  - Gemfile
78
93
  - LICENSE.txt
79
94
  - README.md
80
95
  - Rakefile
81
96
  - delayed_job_exception_notifier.gemspec
97
+ - lib/delayed/backend/dummy.rb
82
98
  - lib/delayed/plugins/exception_notifier.rb
99
+ - lib/delayed/serialization/dummy.rb
83
100
  - lib/delayed_job_exception_notifier.rb
84
101
  - lib/delayed_job_exception_notifier/version.rb
102
+ - spec/delayed_job_exception_notifier_spec.rb
103
+ - spec/spec_helper.rb
85
104
  homepage: https://github.com/nLight/delayed_job_exception_notifier
86
105
  licenses:
87
106
  - MIT
@@ -102,8 +121,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
121
  version: '0'
103
122
  requirements: []
104
123
  rubyforge_project:
105
- rubygems_version: 2.0.3
124
+ rubygems_version: 2.0.5
106
125
  signing_key:
107
126
  specification_version: 4
108
127
  summary: ''
109
- test_files: []
128
+ test_files:
129
+ - spec/delayed_job_exception_notifier_spec.rb
130
+ - spec/spec_helper.rb