resque-exceptional 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.2.0 (2012-09-07)
2
+
3
+ * Changed API URL to: api.exceptional.io
4
+ * Changed test framework to MiniTest.
5
+ * Added Gemfile.
6
+ * Replaced usage of `#to_json` with `MultiJson.dump()`
7
+
1
8
  ## 0.1.0 (2010-10-16)
2
9
 
3
10
  * Added more unit tests.
data/Rakefile CHANGED
@@ -10,6 +10,7 @@ task :default => :test
10
10
  ##
11
11
  # Test task.
12
12
  Rake::TestTask.new(:test) do |task|
13
+ task.libs << 'test'
13
14
  task.test_files = FileList['test/*_test.rb']
14
15
  task.verbose = true
15
16
  end
@@ -19,7 +20,7 @@ end
19
20
  YARD::Rake::YardocTask.new :yardoc do |t|
20
21
  t.files = ['lib/**/*.rb']
21
22
  t.options = ['--output-dir', 'doc/',
22
- '--files', 'LICENSE,HISTORY.md',
23
+ '--files', 'LICENSE HISTORY.md',
23
24
  '--readme', 'README.md',
24
25
  '--title', 'resque-exceptional documentation']
25
- end
26
+ end
@@ -73,7 +73,7 @@ module Resque
73
73
 
74
74
  # Returns the compressed request data.
75
75
  def compressed_request
76
- Zlib::Deflate.deflate(api_request.to_json, Zlib::BEST_SPEED)
76
+ Zlib::Deflate.deflate(MultiJson.dump(api_request), Zlib::BEST_SPEED)
77
77
  end
78
78
 
79
79
  # Path & query options used by the HTTP Post.
@@ -105,7 +105,7 @@ module Resque
105
105
  # pass any proxy settings.
106
106
  proxy = Net::HTTP::Proxy(self.class.proxy_host, self.class.proxy_port,
107
107
  self.class.proxy_user, self.class.proxy_pass)
108
- http = proxy.new('api.getexceptional.com', http_port)
108
+ http = proxy.new('api.exceptional.io', http_port)
109
109
 
110
110
  # set http client options.
111
111
  http.read_timeout = self.class.http_read_timeout || 5
@@ -5,4 +5,4 @@ require 'time'
5
5
  require 'digest/md5'
6
6
  require 'resque'
7
7
 
8
- require 'resque/failure/exceptional'
8
+ require 'resque/failure/exceptional'
@@ -1,7 +1,7 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  # Tests the failure backend works with resque, does not contact the api.
4
- class ExceptionalTest < Test::Unit::TestCase
4
+ class ExceptionalTest < MiniTest::Unit::TestCase
5
5
  def setup
6
6
  @exception = TestApp.grab_exception
7
7
  @worker = FakeWorker.new
@@ -9,7 +9,7 @@ class ExceptionalTest < Test::Unit::TestCase
9
9
  @payload = { 'class' => 'TestJob', 'args' => ['foo', 'bar'] }
10
10
  @failure = Resque::Failure::Exceptional.new(@exception, @worker, @queue, @payload)
11
11
  WebMock.disable_net_connect!
12
- WebMock.reset_webmock
12
+ WebMock.reset!
13
13
  end
14
14
 
15
15
  # test we can build a hash to send to the api.
@@ -95,9 +95,9 @@ class ExceptionalTest < Test::Unit::TestCase
95
95
  # test save success.
96
96
  def test_save_success
97
97
  with_api_key '27810b263f0e11eef2f1d29be75d2f39' do
98
- stub_request(:post, /.*api.getexceptional.com.*/)
98
+ stub_request(:post, /.*api.exceptional.io.*/)
99
99
  @failure.save
100
- assert_requested(:post, /.*api.getexceptional.com.*/)
100
+ assert_requested(:post, /.*api.exceptional.io.*/)
101
101
  assert_match /^(resque-exception).*(success).*$/, @worker.log_history.first
102
102
  end
103
103
  end
@@ -105,9 +105,9 @@ class ExceptionalTest < Test::Unit::TestCase
105
105
  # test save fail.
106
106
  def test_save_fail
107
107
  with_api_key '27810b263f0e11eef2f1d29be75d2f39' do
108
- stub_request(:post, /.*api.getexceptional.com.*/).to_return(:status => [500, 'Internal Server Error'])
108
+ stub_request(:post, /.*api.exceptional.io.*/).to_return(:status => [500, 'Internal Server Error'])
109
109
  @failure.save
110
- assert_requested(:post, /.*api.getexceptional.com.*/)
110
+ assert_requested(:post, /.*api.exceptional.io.*/)
111
111
  assert_match /^(resque-exception).*(fail).*(500).*$/, @worker.log_history.first
112
112
  end
113
113
  end
@@ -198,7 +198,7 @@ class ExceptionalTest < Test::Unit::TestCase
198
198
 
199
199
  # raise exception if api key is not set.
200
200
  def test_http_path_query_without_api_key_raises_exception
201
- assert_raise Resque::Failure::Exceptional::APIKeyError, 'should raise APIKeyError if api key is not set' do
201
+ assert_raises Resque::Failure::Exceptional::APIKeyError, 'should raise APIKeyError if api key is not set' do
202
202
  @failure.http_path_query
203
203
  end
204
204
  end
@@ -206,10 +206,10 @@ class ExceptionalTest < Test::Unit::TestCase
206
206
  # should return http response if successful.
207
207
  def test_http_post_request
208
208
  with_api_key '27810b263f0e11eef2f1d29be75d2f39' do
209
- stub_request(:post, /.*api.getexceptional.com.*/)
209
+ stub_request(:post, /.*api.exceptional.io.*/)
210
210
 
211
211
  response = @failure.http_post_request
212
- assert_requested(:post, /.*api.getexceptional.com.*/)
212
+ assert_requested(:post, /.*api.exceptional.io.*/)
213
213
  assert_equal '200', response.code, 'should be a successful http request'
214
214
  end
215
215
  end
@@ -220,26 +220,26 @@ class ExceptionalTest < Test::Unit::TestCase
220
220
  assert_equal nil, @failure.http_post_request, 'should be nil, APIKeyError should have been caught.'
221
221
 
222
222
  with_api_key '27810b263f0e11eef2f1d29be75d2f39' do
223
- WebMock.reset_webmock
224
- stub_request(:post, /.*api.getexceptional.com.*/).to_raise(StandardError)
223
+ WebMock.reset!
224
+ stub_request(:post, /.*api.exceptional.io.*/).to_raise(StandardError)
225
225
  assert_equal nil, @failure.http_post_request, 'should be nil, StandardError should have been caught.'
226
- assert_requested(:post, /.*api.getexceptional.com.*/)
226
+ assert_requested(:post, /.*api.exceptional.io.*/)
227
227
  end
228
228
  end
229
229
 
230
230
  # make sure we catch timeout errors.
231
231
  def test_http_post_request_timeout
232
232
  with_api_key '27810b263f0e11eef2f1d29be75d2f39' do
233
- stub_request(:post, /.*api.getexceptional.com.*/).to_timeout
233
+ stub_request(:post, /.*api.exceptional.io.*/).to_timeout
234
234
  assert_equal nil, @failure.http_post_request, 'should be nil, TimeoutError should have been caught.'
235
- assert_requested(:post, /.*api.getexceptional.com.*/)
235
+ assert_requested(:post, /.*api.exceptional.io.*/)
236
236
  end
237
237
  end
238
238
 
239
239
  # perform a test with the real api.
240
240
  def test_live_fire_with_real_api!
241
241
  unless ENV['EXCEPTIONAL_API_KEY']
242
- omit 'Test with the REAL API. Example: `EXCEPTIONAL_API_KEY=27810b263f0e11eef2f1d29be75d2f39 rake test`'
242
+ skip 'Test with the REAL API. Example: `EXCEPTIONAL_API_KEY=27810b263f0e11eef2f1d29be75d2f39 bundle exec rake test`'
243
243
  end
244
244
 
245
245
  with_api_key ENV['EXCEPTIONAL_API_KEY'] do
data/test/resque_test.rb CHANGED
@@ -1,10 +1,11 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  # make sure the worlds not fallen from beneith us.
4
- class ResqueTest < Test::Unit::TestCase
4
+ class ResqueTest < MiniTest::Unit::TestCase
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'
8
8
  assert_operator minor.to_i, :>=, 8, 'minor version is too low'
9
9
  end
10
- end
10
+
11
+ end
data/test/test_helper.rb CHANGED
@@ -1,24 +1,30 @@
1
- require 'simplecov'
2
- SimpleCov.start do
3
- add_filter '/test/'
4
- end
5
-
1
+ # fix load path.
6
2
  dir = File.dirname(File.expand_path(__FILE__))
7
3
  $LOAD_PATH.unshift dir + '/../lib'
8
4
  $TESTING = true
9
5
 
10
- require 'test/unit'
6
+ # require gems for testing.
11
7
  require 'rubygems'
8
+ require 'minitest/unit'
9
+ require 'minitest/pride'
10
+ require 'minitest/autorun'
12
11
  require 'rr'
13
12
  require 'webmock'
14
- require 'webmock/test_unit'
13
+ require 'webmock/minitest'
14
+
15
+ # Run code coverage in MRI 1.9 only.
16
+ if RUBY_VERSION >= '1.9' && RUBY_ENGINE == 'ruby'
17
+ require 'simplecov'
18
+ SimpleCov.start do
19
+ add_filter '/test/'
20
+ end
21
+ end
15
22
 
16
23
  # require our failure backend to test.
17
24
  require 'resque-exceptional'
18
25
 
19
- class Test::Unit::TestCase
26
+ class MiniTest::Unit::TestCase
20
27
  include RR::Adapters::TestUnit
21
- include WebMock::API
22
28
 
23
29
  # periodicly set the api key.
24
30
  def with_api_key(key, &block)
@@ -67,4 +73,4 @@ module TestApp
67
73
  end
68
74
  end
69
75
 
70
- end
76
+ end
metadata CHANGED
@@ -1,122 +1,151 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: resque-exceptional
3
- version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 1
9
- - 0
10
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Luke Antins
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2010-10-16 00:00:00 +01:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-09-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: resque
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.8.0
22
+ type: :runtime
23
23
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 55
30
- segments:
31
- - 1
32
- - 8
33
- - 0
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
34
29
  version: 1.8.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: multi_json
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
35
38
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: test-unit
39
39
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 3
46
- segments:
47
- - 0
48
- version: "0"
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
49
54
  type: :development
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: rr
53
55
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 23
60
- segments:
61
- - 1
62
- - 0
63
- - 0
64
- version: 1.0.0
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: minitest
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
65
70
  type: :development
66
- version_requirements: *id003
67
- - !ruby/object:Gem::Dependency
68
- name: webmock
69
71
  prerelease: false
70
- requirement: &id004 !ruby/object:Gem::Requirement
71
- none: false
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- hash: 3
76
- segments:
77
- - 0
78
- version: "0"
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: rr
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
79
86
  type: :development
80
- version_requirements: *id004
81
- - !ruby/object:Gem::Dependency
82
- name: yard
83
87
  prerelease: false
84
- requirement: &id005 !ruby/object:Gem::Requirement
85
- none: false
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- hash: 3
90
- segments:
91
- - 0
92
- version: "0"
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: webmock
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: yard
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
93
118
  type: :development
94
- version_requirements: *id005
95
- - !ruby/object:Gem::Dependency
96
- name: simplecov
97
119
  prerelease: false
98
- requirement: &id006 !ruby/object:Gem::Requirement
99
- none: false
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- hash: 19
104
- segments:
105
- - 0
106
- - 3
107
- - 0
108
- version: 0.3.0
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: simplecov
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
109
134
  type: :development
110
- version_requirements: *id006
111
- description: " resque-exceptional provides a Resque failure backend that sends exceptions\n raised by jobs to getexceptional.com.\n"
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !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"
112
144
  email: luke@lividpenguin.com
113
145
  executables: []
114
-
115
146
  extensions: []
116
-
117
147
  extra_rdoc_files: []
118
-
119
- files:
148
+ files:
120
149
  - LICENSE
121
150
  - Rakefile
122
151
  - README.md
@@ -126,39 +155,29 @@ files:
126
155
  - test/test_helper.rb
127
156
  - lib/resque/failure/exceptional.rb
128
157
  - lib/resque-exceptional.rb
129
- has_rdoc: false
130
158
  homepage: http://github.com/lantins/resque-exceptional
131
159
  licenses: []
132
-
133
160
  post_install_message:
134
161
  rdoc_options: []
135
-
136
- require_paths:
162
+ require_paths:
137
163
  - lib
138
- required_ruby_version: !ruby/object:Gem::Requirement
164
+ required_ruby_version: !ruby/object:Gem::Requirement
139
165
  none: false
140
- requirements:
141
- - - ">="
142
- - !ruby/object:Gem::Version
143
- hash: 3
144
- segments:
145
- - 0
146
- version: "0"
147
- required_rubygems_version: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ! '>='
168
+ - !ruby/object:Gem::Version
169
+ version: '0'
170
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
171
  none: false
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- hash: 3
153
- segments:
154
- - 0
155
- version: "0"
172
+ requirements:
173
+ - - ! '>='
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
156
176
  requirements: []
157
-
158
177
  rubyforge_project:
159
- rubygems_version: 1.3.7
178
+ rubygems_version: 1.8.24
160
179
  signing_key:
161
180
  specification_version: 3
162
181
  summary: A Resque failure backend for getexceptional.com
163
182
  test_files: []
164
-
183
+ has_rdoc: false