resque-exceptional 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 48421f431f10aec6b365354e1d44dd0c66272050
4
+ data.tar.gz: 7dee6f702e31f801708c436121ed8de4460aae9f
5
+ SHA512:
6
+ metadata.gz: 8536ba180441cd4e048fbddb1d6c422cbda6b32439e3c6a737e19d5f9bdc01d25c107f0b2b8b7334f95e1d27880cae70d2e83ce23e200a556c084d95f6189465
7
+ data.tar.gz: 2ad61434db9e6ab41a623d2cf93ca44fced897310d81ecc4dd84f3a6b87cd36597ff6c7414ec1e6ccc6798f7b2d19580c85ad8904c8eb1488f75cf37e05f5a50
data/HISTORY.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.1 (2014-02-21)
2
+
3
+ * Add `deliver` config option; `false` will disable delivery, good for tests.
4
+
1
5
  ## 0.2.0 (2012-09-07)
2
6
 
3
7
  * Changed API URL to: api.exceptional.io
data/README.md CHANGED
@@ -4,6 +4,8 @@ resque-exceptional
4
4
  resque-exceptional provides a [Resque][re] failure backend that sends exceptions
5
5
  raised by jobs to [getexceptional.com][ge]
6
6
 
7
+ [![Build Status](https://secure.travis-ci.org/lantins/resque-exceptional.png?branch=master)](http://travis-ci.org/lantins/resque-exceptional)
8
+
7
9
  Install & Quick Start
8
10
  ---------------------
9
11
 
@@ -2,7 +2,7 @@ module Resque
2
2
  module Failure
3
3
  # A Resque failure backend that sends exception data to getexceptional.com
4
4
  class Exceptional < Base
5
- Version = '0.1.0' # Failure backend version number.
5
+ Version = '0.2.1' # Failure backend version number.
6
6
 
7
7
  # Raised if the api_key is not set.
8
8
  class APIKeyError < StandardError
@@ -11,6 +11,7 @@ module Resque
11
11
  class << self
12
12
  attr_accessor :api_key # your getexceptional api key.
13
13
  attr_accessor :use_ssl # enable/disable SSL.
14
+ attr_accessor :deliver # whether or not to submit exceptions to Exceptional
14
15
  # HTTP proxy option
15
16
  attr_accessor :proxy_host, :proxy_port, :proxy_user, :proxy_pass
16
17
  # HTTP client option
@@ -33,6 +34,7 @@ module Resque
33
34
  #
34
35
  # When a job fails, a new instance is created and #save is called.
35
36
  def save
37
+ return nil if self.class.deliver === false
36
38
  return unless response = http_post_request
37
39
 
38
40
  if response.code == '200'
@@ -64,7 +66,7 @@ module Resque
64
66
  #
65
67
  # @return [Hash] http headers.
66
68
  def http_headers
67
- {
69
+ {
68
70
  'Content-Type' => 'application/json',
69
71
  'Accept' => 'application/json',
70
72
  'User-Agent' => "resque-exceptional/#{Version}"
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  # Tests the failure backend works with resque, does not contact the api.
4
- class ExceptionalTest < MiniTest::Unit::TestCase
4
+ class ExceptionalTest < Minitest::Test
5
5
  def setup
6
6
  @exception = TestApp.grab_exception
7
7
  @worker = FakeWorker.new
@@ -112,6 +112,20 @@ class ExceptionalTest < MiniTest::Unit::TestCase
112
112
  end
113
113
  end
114
114
 
115
+ # test save does not submit to Exceptional if deliveries are disabled
116
+ def test_do_not_submit_if_deliveries_are_disabled
117
+ with_api_key '27810b263f0e11eef2f1d29be75d2f39' do
118
+ # turn off delivery.
119
+ Resque::Failure::Exceptional.configure { |c| c.deliver = false }
120
+ stub_request(:post, /.*api.exceptional.io.*/)
121
+ @failure.save
122
+ assert_equal(0, @worker.log_history.length)
123
+
124
+ # Put default setting back in place.
125
+ Resque::Failure::Exceptional.configure { |c| c.deliver = nil }
126
+ end
127
+ end
128
+
115
129
  # we need a Net::HTTP client setup to send the data.
116
130
  def test_http_client
117
131
  assert_kind_of Net::HTTP, @failure.http_client
data/test/resque_test.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  # make sure the worlds not fallen from beneith us.
4
- class ResqueTest < MiniTest::Unit::TestCase
4
+ class ResqueTest < Minitest::Test
5
5
  def test_resque_version
6
6
  major, minor, patch = Resque::Version.split('.')
7
7
  assert_equal 1, major.to_i, 'major version does not match'
data/test/test_helper.rb CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift dir + '/../lib'
4
4
  $TESTING = true
5
5
 
6
6
  # require gems for testing.
7
- require 'rubygems'
7
+ require 'minitest'
8
8
  require 'minitest/unit'
9
9
  require 'minitest/pride'
10
10
  require 'minitest/autorun'
@@ -23,8 +23,8 @@ end
23
23
  # require our failure backend to test.
24
24
  require 'resque-exceptional'
25
25
 
26
- class MiniTest::Unit::TestCase
27
- include RR::Adapters::TestUnit
26
+ class Minitest::Test
27
+ include WebMock::API
28
28
 
29
29
  # periodicly set the api key.
30
30
  def with_api_key(key, &block)
metadata CHANGED
@@ -1,183 +1,167 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-exceptional
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
5
- prerelease:
4
+ version: 0.2.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Luke Antins
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-09-07 00:00:00.000000000 Z
11
+ date: 2014-02-21 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: resque
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
- version: 1.8.0
19
+ version: '1.8'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: 1.8.0
26
+ version: '1.8'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: multi_json
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
- version: '0'
33
+ version: '1.0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
- version: '0'
40
+ version: '1.0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: minitest
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - "~>"
68
60
  - !ruby/object:Gem::Version
69
- version: '0'
61
+ version: '5.2'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - "~>"
76
67
  - !ruby/object:Gem::Version
77
- version: '0'
68
+ version: '5.2'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rr
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - "~>"
84
74
  - !ruby/object:Gem::Version
85
- version: '0'
75
+ version: '1.1'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - "~>"
92
81
  - !ruby/object:Gem::Version
93
- version: '0'
82
+ version: '1.1'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: webmock
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - "~>"
100
88
  - !ruby/object:Gem::Version
101
- version: '0'
89
+ version: '1.8'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - "~>"
108
95
  - !ruby/object:Gem::Version
109
- version: '0'
96
+ version: '1.8'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: yard
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - "~>"
116
102
  - !ruby/object:Gem::Version
117
- version: '0'
103
+ version: '0.8'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - "~>"
124
109
  - !ruby/object:Gem::Version
125
- version: '0'
110
+ version: '0.8'
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: simplecov
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - "~>"
132
116
  - !ruby/object:Gem::Version
133
- version: '0'
117
+ version: '0.8'
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - "~>"
140
123
  - !ruby/object:Gem::Version
141
- version: '0'
142
- description: ! " resque-exceptional provides a Resque failure backend that sends
143
- exceptions\n raised by jobs to getexceptional.com.\n"
124
+ version: '0.8'
125
+ description: |2
126
+ resque-exceptional provides a Resque failure backend that sends exceptions
127
+ raised by jobs to getexceptional.com.
144
128
  email: luke@lividpenguin.com
145
129
  executables: []
146
130
  extensions: []
147
131
  extra_rdoc_files: []
148
132
  files:
133
+ - HISTORY.md
149
134
  - LICENSE
150
- - Rakefile
151
135
  - README.md
152
- - HISTORY.md
136
+ - Rakefile
137
+ - lib/resque-exceptional.rb
138
+ - lib/resque/failure/exceptional.rb
153
139
  - test/exceptional_test.rb
154
140
  - test/resque_test.rb
155
141
  - test/test_helper.rb
156
- - lib/resque/failure/exceptional.rb
157
- - lib/resque-exceptional.rb
158
142
  homepage: http://github.com/lantins/resque-exceptional
159
- licenses: []
143
+ licenses:
144
+ - MIT
145
+ metadata: {}
160
146
  post_install_message:
161
147
  rdoc_options: []
162
148
  require_paths:
163
149
  - lib
164
150
  required_ruby_version: !ruby/object:Gem::Requirement
165
- none: false
166
151
  requirements:
167
- - - ! '>='
152
+ - - ">="
168
153
  - !ruby/object:Gem::Version
169
154
  version: '0'
170
155
  required_rubygems_version: !ruby/object:Gem::Requirement
171
- none: false
172
156
  requirements:
173
- - - ! '>='
157
+ - - ">="
174
158
  - !ruby/object:Gem::Version
175
159
  version: '0'
176
160
  requirements: []
177
161
  rubyforge_project:
178
- rubygems_version: 1.8.24
162
+ rubygems_version: 2.2.0
179
163
  signing_key:
180
- specification_version: 3
164
+ specification_version: 4
181
165
  summary: A Resque failure backend for getexceptional.com
182
166
  test_files: []
183
167
  has_rdoc: false