resque-scheduler 4.2.0 → 4.2.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of resque-scheduler might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac7465394b46317c0dcce4eff62880f4bd74a823
4
- data.tar.gz: 1e6070308b4cce022aa2045b7980c25ac4fc2418
3
+ metadata.gz: 81fff7dfc51eb7cddf965e33bb199119c5e89654
4
+ data.tar.gz: ad07b64387f32238e6d40ddd7a23013909690525
5
5
  SHA512:
6
- metadata.gz: 1ccd3427d6b1fc19366ae68ccdce9b69fba9502bf6aee13111aa3a5f486fd6334d0158291714de187b54b48000fafa878529a32413214306b86d6d914ccb37ab
7
- data.tar.gz: 418d846ccd4be98b42e8ead43e44b361e2e1ae27b2f6e1ff761d3724dd54d318d8b339b3b399ab680f096c2d2492f85eedfe10fd4cc0465a6d2a1c93b1bc18c7
6
+ metadata.gz: 352f5afdf0b0298c325e69cd2602e327f43f27a32286c5d07c1a7bab3d68848eabfc01d3d7c2b403c1250eaf1f43cee3fc1b0070bed57da3ff152cc322ee70f4
7
+ data.tar.gz: 02404afea3608f6280be6f6e7063a08e5eb75177a28506bea7a60960c3792bb68243d4701b76a3a4d62fdc1b052e744eb2c949a23cddc915032a0c137c5df2cb
@@ -1,18 +1,22 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-04-22 13:22:42 -0400 using RuboCop version 0.35.1.
3
+ # on 2016-05-27 14:45:04 -0400 using RuboCop version 0.40.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 2
9
+ # Offense count: 1
10
10
  # Configuration parameters: AllowSafeAssignment.
11
11
  Lint/AssignmentInCondition:
12
12
  Exclude:
13
- - 'lib/resque/scheduler/delaying_extensions.rb'
14
13
  - 'lib/resque/scheduler/env.rb'
15
14
 
15
+ # Offense count: 2
16
+ Lint/UselessAccessModifier:
17
+ Exclude:
18
+ - 'lib/resque/scheduler.rb'
19
+
16
20
  # Offense count: 16
17
21
  Metrics/AbcSize:
18
22
  Max: 36
@@ -21,10 +25,11 @@ Metrics/AbcSize:
21
25
  Metrics/CyclomaticComplexity:
22
26
  Max: 12
23
27
 
24
- # Offense count: 2
25
- # Configuration parameters: AllowURI, URISchemes.
28
+ # Offense count: 6
29
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
30
+ # URISchemes: http, https
26
31
  Metrics/LineLength:
27
- Max: 87
32
+ Max: 96
28
33
 
29
34
  # Offense count: 19
30
35
  # Configuration parameters: CountComments.
@@ -47,16 +52,20 @@ Style/EachWithObject:
47
52
  - 'lib/resque/scheduler.rb'
48
53
 
49
54
  # Offense count: 3
50
- # Configuration parameters: Exclude.
55
+ # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts.
51
56
  Style/FileName:
52
57
  Exclude:
53
58
  - 'examples/config/initializers/resque-web.rb'
54
59
  - 'lib/resque-scheduler.rb'
55
60
  - 'test/resque-web_test.rb'
56
61
 
57
- # Offense count: 5
62
+ # Offense count: 1
58
63
  # Configuration parameters: MinBodyLength.
59
64
  Style/GuardClause:
60
65
  Exclude:
61
- - 'lib/resque/scheduler.rb'
62
66
  - 'lib/resque/scheduler/lock/basic.rb'
67
+
68
+ # Offense count: 1
69
+ Style/IfInsideElse:
70
+ Exclude:
71
+ - 'lib/resque/scheduler.rb'
@@ -2,25 +2,18 @@ language: ruby
2
2
  sudo: false
3
3
  rvm:
4
4
  - 1.9.3
5
- - 2.3.0
6
- - jruby-19mode
7
- - rbx
5
+ - 2.3.1
6
+ - jruby-9.1.1.0
8
7
  env:
9
8
  global:
10
- - JRUBY_OPTS='-Xcext.enabled=true'
11
9
  - COVERAGE=1
10
+ - JRUBY_OPTS=''
11
+ - RUBYOPT='-W0'
12
12
  matrix:
13
13
  allow_failures:
14
- - rvm: jruby-19mode
15
- - rvm: rbx
14
+ - rvm: jruby-9.1.1.0
16
15
  services:
17
16
  - redis-server
18
- notifications:
19
- irc:
20
- channels:
21
- - 'chat.freenode.net#resque'
22
- on_success: change
23
- on_failure: change
24
17
  deploy:
25
18
  provider: rubygems
26
19
  api_key:
@@ -29,5 +22,5 @@ deploy:
29
22
  on:
30
23
  tags: true
31
24
  repo: resque/resque-scheduler
32
- rvm: 2.3.0
25
+ rvm: 2.3.1
33
26
  all_branches: true
data/HISTORY.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Resque Scheduler History / ChangeLog / Release Notes
2
2
 
3
+ ## 4.2.1 (2016-06-08)
4
+ * Optimization of `find_delayed_selection`
5
+ * More defensive code around redis disconnects
6
+ * Only trap existing signals on given platform
7
+ * RuboCop auto-fixes
8
+ * Dependency updates
9
+ * Docs improvements
10
+
3
11
  ## 4.2.0 (2016-04-29)
4
12
  * Bugfix for a race condition in concurrent restarts
5
13
  * Clean up and simplify the scheduling extension
data/README.md CHANGED
@@ -19,9 +19,9 @@ jobs are resque jobs that you want to run at some point in the future.
19
19
  The syntax is pretty explanatory:
20
20
 
21
21
  ```ruby
22
- Resque.enqueue_in(5.days, SendFollowupEmail) # run a job in 5 days
22
+ Resque.enqueue_in(5.days, SendFollowupEmail, argument) # runs a job in 5 days, calling SendFollowupEmail.perform(argument)
23
23
  # or
24
- Resque.enqueue_at(5.days.from_now, SomeJob) # run SomeJob at a specific time
24
+ Resque.enqueue_at(5.days.from_now, SomeJob, argument) # runs a job at a specific time, calling SomeJob.perform(argument)
25
25
  ```
26
26
 
27
27
  ### Documentation
@@ -12,20 +12,20 @@ require 'resque/scheduler/server'
12
12
 
13
13
  schedule_yml = ENV['RESQUE_SCHEDULE_YML']
14
14
  if schedule_yml
15
- if File.exist?(schedule_yml)
16
- Resque.schedule = YAML.load_file(schedule_yml)
17
- else
18
- Resque.schedule = YAML.load(schedule_yml)
19
- end
15
+ Resque.schedule = if File.exist?(schedule_yml)
16
+ YAML.load_file(schedule_yml)
17
+ else
18
+ YAML.load(schedule_yml)
19
+ end
20
20
  end
21
21
 
22
22
  schedule_json = ENV['RESQUE_SCHEDULE_JSON']
23
23
  if schedule_json
24
- if File.exist?(schedule_json)
25
- Resque.schedule = JSON.parse(File.read(schedule_json))
26
- else
27
- Resque.schedule = JSON.parse(schedule_json)
28
- end
24
+ Resque.schedule = if File.exist?(schedule_json)
25
+ JSON.parse(File.read(schedule_json))
26
+ else
27
+ JSON.parse(schedule_json)
28
+ end
29
29
  end
30
30
 
31
31
  class Putter
@@ -38,7 +38,7 @@ class FixSchedulesJob
38
38
  users_unscheduled << user if schedule.nil?
39
39
  end
40
40
 
41
- if users_unscheduled.length > 0
41
+ unless users_unscheduled.empty?
42
42
  users_unscheduled.each do |user|
43
43
  name = "send_email_#{user.id}"
44
44
  config = {}
@@ -57,13 +57,14 @@ module Resque
57
57
 
58
58
  # Now start the scheduling part of the loop.
59
59
  loop do
60
- if master?
61
- begin
60
+ begin
61
+ if master?
62
62
  handle_delayed_items
63
63
  update_schedule if dynamic
64
- rescue Errno::EAGAIN, Errno::ECONNRESET => e
65
- log! e.message
66
64
  end
65
+ rescue Errno::EAGAIN, Errno::ECONNRESET, Redis::CannotConnectError => e
66
+ log! e.message
67
+ release_master_lock
67
68
  end
68
69
  poll_sleep
69
70
  end
@@ -135,7 +136,7 @@ module Resque
135
136
  interval_defined = false
136
137
  interval_types = %w(cron every)
137
138
  interval_types.each do |interval_type|
138
- next unless !config[interval_type].nil? && config[interval_type].length > 0
139
+ next unless !config[interval_type].nil? && !config[interval_type].empty?
139
140
  args = optionizate_interval_value(config[interval_type])
140
141
  args = [args, nil, job: true] if args.is_a?(::String)
141
142
 
@@ -16,7 +16,7 @@ module Resque
16
16
  pidfile: 'PIDFILE',
17
17
  poll_sleep_amount: 'RESQUE_SCHEDULER_INTERVAL',
18
18
  verbose: 'VERBOSE'
19
- }
19
+ }.freeze
20
20
 
21
21
  class Cli
22
22
  BANNER = <<-EOF.gsub(/ {6}/, '')
@@ -129,7 +129,7 @@ module Resque
129
129
  OptionParser.new do |opts|
130
130
  opts.banner = BANNER
131
131
  OPTIONS.each do |opt|
132
- opts.on(*opt[:args], &(opt[:callback].call(options)))
132
+ opts.on(*opt[:args], &opt[:callback].call(options))
133
133
  end
134
134
  end
135
135
  end
@@ -156,7 +156,7 @@ module Resque
156
156
  # This allows for removal of delayed jobs that have arguments matching
157
157
  # certain criteria
158
158
  def remove_delayed_selection(klass = nil)
159
- fail ArgumentError, 'Please supply a block' unless block_given?
159
+ raise ArgumentError, 'Please supply a block' unless block_given?
160
160
 
161
161
  found_jobs = find_delayed_selection(klass) { |args| yield(args) }
162
162
  found_jobs.reduce(0) do |sum, encoded_job|
@@ -169,7 +169,7 @@ module Resque
169
169
  # This allows for enqueuing of delayed jobs that have arguments matching
170
170
  # certain criteria
171
171
  def enqueue_delayed_selection(klass = nil)
172
- fail ArgumentError, 'Please supply a block' unless block_given?
172
+ raise ArgumentError, 'Please supply a block' unless block_given?
173
173
 
174
174
  found_jobs = find_delayed_selection(klass) { |args| yield(args) }
175
175
  found_jobs.reduce(0) do |sum, encoded_job|
@@ -184,24 +184,24 @@ module Resque
184
184
  # This allows for finding of delayed jobs that have arguments matching
185
185
  # certain criteria
186
186
  def find_delayed_selection(klass = nil, &block)
187
- fail ArgumentError, 'Please supply a block' unless block_given?
188
-
189
- found_jobs = []
190
- start = nil
191
- while start = search_first_delayed_timestamp_in_range(start, nil)
192
- job = "delayed:#{start}"
193
- start += 1
194
- index = Resque.redis.llen(job) - 1
195
- while index >= 0
196
- payload = Resque.redis.lindex(job, index)
197
- decoded_payload = decode(payload)
198
- if payload_matches_selection?(decoded_payload, klass, &block)
199
- found_jobs.push(payload)
187
+ raise ArgumentError, 'Please supply a block' unless block_given?
188
+
189
+ timestamps = redis.zrange(:delayed_queue_schedule, 0, -1)
190
+
191
+ # Beyond 100 there's almost no improvement in speed
192
+ found = timestamps.each_slice(100).map do |ts_group|
193
+ jobs = redis.pipelined do |r|
194
+ ts_group.each do |ts|
195
+ r.lrange("delayed:#{ts}", 0, -1)
200
196
  end
201
- index -= 1
197
+ end
198
+
199
+ jobs.flatten.select do |payload|
200
+ payload_matches_selection?(decode(payload), klass, &block)
202
201
  end
203
202
  end
204
- found_jobs
203
+
204
+ found.flatten
205
205
  end
206
206
 
207
207
  # Given a timestamp and job (klass + args) it removes all instances and
@@ -16,7 +16,7 @@ module Resque
16
16
 
17
17
  # Attempts to acquire the lock. Returns true if successfully acquired.
18
18
  def acquire!
19
- fail NotImplementedError
19
+ raise NotImplementedError
20
20
  end
21
21
 
22
22
  def value
@@ -25,7 +25,7 @@ module Resque
25
25
 
26
26
  # Returns true if you currently hold the lock.
27
27
  def locked?
28
- fail NotImplementedError
28
+ raise NotImplementedError
29
29
  end
30
30
 
31
31
  # Releases the lock.
@@ -76,6 +76,8 @@ module Resque
76
76
 
77
77
  def release_master_lock
78
78
  master_lock.release
79
+ rescue Errno::EAGAIN, Errno::ECONNRESET, Redis::CannotConnectError
80
+ @master_lock = nil
79
81
  end
80
82
 
81
83
  private
@@ -8,7 +8,7 @@ require 'json'
8
8
  module Resque
9
9
  module Scheduler
10
10
  module Server
11
- TIMESTAMP_FORMAT = '%Y-%m-%d %H:%M:%S %z'
11
+ TIMESTAMP_FORMAT = '%Y-%m-%d %H:%M:%S %z'.freeze
12
12
 
13
13
  unless defined?(::Resque::Scheduler::Server::VIEW_PATH)
14
14
  VIEW_PATH = File.join(File.dirname(__FILE__), 'server', 'views')
@@ -158,7 +158,7 @@ module Resque
158
158
  dels = delayed_jobs_for_worker(worker)
159
159
  results += dels.select do |j|
160
160
  j['class'].downcase.include?(worker) &&
161
- j.merge!('where_at' => 'delayed')
161
+ j.merge!('where_at' => 'delayed')
162
162
  end
163
163
 
164
164
  Resque.queues.each do |queue|
@@ -166,7 +166,7 @@ module Resque
166
166
  queued = [queued] unless queued.is_a?(Array)
167
167
  results += queued.select do |j|
168
168
  j['class'].downcase.include?(worker) &&
169
- j.merge!('queue' => queue, 'where_at' => 'queued')
169
+ j.merge!('queue' => queue, 'where_at' => 'queued')
170
170
  end
171
171
  end
172
172
 
@@ -231,7 +231,7 @@ module Resque
231
231
  working = [*Resque.working]
232
232
  work = working.select do |w|
233
233
  w.job && w.job['payload'] &&
234
- w.job['payload']['class'].downcase.include?(worker)
234
+ w.job['payload']['class'].downcase.include?(worker)
235
235
  end
236
236
  work.each do |w|
237
237
  results += [
@@ -248,9 +248,10 @@ module Resque
248
248
  schedule_size = Resque.delayed_queue_schedule_size
249
249
  Resque.delayed_queue_peek(0, schedule_size).each do |d|
250
250
  Resque.delayed_timestamp_peek(
251
- d, 0, Resque.delayed_timestamp_size(d)).each do |j|
252
- dels << j.merge!('timestamp' => d)
253
- end
251
+ d, 0, Resque.delayed_timestamp_size(d)
252
+ ).each do |j|
253
+ dels << j.merge!('timestamp' => d)
254
+ end
254
255
  end
255
256
  end
256
257
  end
@@ -23,7 +23,7 @@
23
23
  <form action="<%= u "/delayed/cancel_now" %>" method="post">
24
24
  <input type="hidden" name="timestamp" value="<%= job['timestamp'].to_i %>">
25
25
  <input type="hidden" name="klass" value="<%= job['class'] %>">
26
- <input type="hidden" name="args" value="<%= Resque.encode job['args'] %>">
26
+ <input type="hidden" name="args" value="<%= h(Resque.encode job['args']) %>">
27
27
  <input type="submit" value="Cancel Job">
28
28
  </form>
29
29
  </td>
@@ -13,7 +13,7 @@ module Resque
13
13
  # poll/enqueing to finish (should be almost instant). In the
14
14
  # case of sleeping, exit immediately.
15
15
  def register_signal_handlers
16
- %w(INT TERM USR1 USR2 QUIT).each do |sig|
16
+ (Signal.list.keys & %w(INT TERM USR1 USR2 QUIT)).each do |sig|
17
17
  trap(sig) do
18
18
  signal_queue << sig
19
19
  # break sleep in the primary scheduler thread, alowing
@@ -22,11 +22,11 @@ module Resque
22
22
  names.each do |name|
23
23
  args = Module.method(:const_get).arity != 1 ? [false] : []
24
24
 
25
- if constant.const_defined?(name, *args)
26
- constant = constant.const_get(name)
27
- else
28
- constant = constant.const_missing(name)
29
- end
25
+ constant = if constant.const_defined?(name, *args)
26
+ constant.const_get(name)
27
+ else
28
+ constant.const_missing(name)
29
+ end
30
30
  end
31
31
  constant
32
32
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Resque
4
4
  module Scheduler
5
- VERSION = '4.2.0'
5
+ VERSION = '4.2.1'.freeze
6
6
  end
7
7
  end
@@ -36,10 +36,10 @@ Gem::Specification.new do |spec|
36
36
 
37
37
  # We pin rubocop because new cops have a tendency to result in false-y
38
38
  # positives for new contributors, which is not a nice experience.
39
- spec.add_development_dependency 'rubocop', '~> 0.35.1'
39
+ spec.add_development_dependency 'rubocop', '~> 0.40.0'
40
40
 
41
41
  spec.add_runtime_dependency 'mono_logger', '~> 1.0'
42
- spec.add_runtime_dependency 'redis', '~> 3.0'
43
- spec.add_runtime_dependency 'resque', '~> 1.25'
42
+ spec.add_runtime_dependency 'redis', '~> 3.3'
43
+ spec.add_runtime_dependency 'resque', '~> 1.26'
44
44
  spec.add_runtime_dependency 'rufus-scheduler', '~> 3.2'
45
45
  end
@@ -247,7 +247,7 @@ context 'DelayedQueue' do
247
247
  test 'calls klass#scheduled when enqueuing jobs if it exists' do
248
248
  t = Time.now - 60
249
249
  FakeCustomJobClassEnqueueAt.expects(:scheduled)
250
- .once.with(:test, FakeCustomJobClassEnqueueAt.to_s, foo: 'bar')
250
+ .once.with(:test, FakeCustomJobClassEnqueueAt.to_s, foo: 'bar')
251
251
  Resque.enqueue_at(t, FakeCustomJobClassEnqueueAt, foo: 'bar')
252
252
  end
253
253
 
@@ -258,7 +258,7 @@ context 'DelayedQueue' do
258
258
  Resque.inline = true
259
259
  t = Time.now - 60
260
260
  FakeCustomJobClassEnqueueAt.expects(:scheduled)
261
- .once.with(:test, FakeCustomJobClassEnqueueAt.to_s, foo: 'bar')
261
+ .once.with(:test, FakeCustomJobClassEnqueueAt.to_s, foo: 'bar')
262
262
  Resque.enqueue_at(t, FakeCustomJobClassEnqueueAt, foo: 'bar')
263
263
  ensure
264
264
  Resque.inline = old_val
@@ -104,9 +104,9 @@ context 'Multi Process' do
104
104
  children.each do |pid, pipe|
105
105
  wait_for_child_process_to_terminate(pid)
106
106
 
107
- fail "forked process failed with #{$CHILD_STATUS}" unless $CHILD_STATUS.success?
107
+ raise "forked process failed with #{$CHILD_STATUS}" unless $CHILD_STATUS.success?
108
108
  result, exc = Marshal.load(pipe.read)
109
- fail exc if exc
109
+ raise exc if exc
110
110
  results << result
111
111
  end
112
112
  results
@@ -80,7 +80,7 @@ context 'on GET to /delayed' do
80
80
  test('is 200') { assert last_response.ok? }
81
81
  end
82
82
 
83
- context 'on GET to /delayed/jobs/:klass'do
83
+ context 'on GET to /delayed/jobs/:klass' do
84
84
  setup do
85
85
  @t = Time.now + 3600
86
86
  Resque.enqueue_at(@t, SomeIvarJob, 'foo', 'bar')
@@ -144,7 +144,7 @@ module Test
144
144
  }
145
145
  }
146
146
  }
147
- }
147
+ }.freeze
148
148
  end
149
149
 
150
150
  context 'POST /schedule/requeue' do
@@ -157,7 +157,7 @@ context 'POST /schedule/requeue' do
157
157
  # Regular jobs without params should redirect to /overview
158
158
  job_name = 'job_without_params'
159
159
  Resque::Scheduler.stubs(:enqueue_from_config)
160
- .once.with(Resque.schedule[job_name])
160
+ .once.with(Resque.schedule[job_name])
161
161
 
162
162
  post '/schedule/requeue', 'job_name' => job_name
163
163
  follow_redirect!
@@ -220,7 +220,7 @@ end
220
220
  context 'on POST to /delayed/search' do
221
221
  setup do
222
222
  t = Time.now + 60
223
- Resque.enqueue_at(t, SomeIvarJob)
223
+ Resque.enqueue_at(t, SomeIvarJob, 'string arg')
224
224
  Resque.enqueue(SomeQuickJob)
225
225
  end
226
226
 
@@ -230,6 +230,11 @@ context 'on POST to /delayed/search' do
230
230
  assert last_response.body.include?('SomeIvarJob')
231
231
  end
232
232
 
233
+ test 'the form should encode string params' do
234
+ post '/delayed/search', 'search' => 'ivar'
235
+ assert_match('value="[&quot;string arg&quot;]', last_response.body)
236
+ end
237
+
233
238
  test 'should find matching queued job' do
234
239
  post '/delayed/search', 'search' => 'quick'
235
240
  assert last_response.status == 200
@@ -238,9 +243,38 @@ context 'on POST to /delayed/search' do
238
243
  end
239
244
 
240
245
  context 'on POST to /delayed/cancel_now' do
241
- setup { post '/delayed/cancel_now' }
246
+ setup do
247
+ Resque.reset_delayed_queue
248
+ Resque.enqueue_at(Time.now + 10, SomeIvarJob, 'arg')
249
+ Resque.enqueue_at(Time.now + 100, SomeQuickJob)
250
+ end
251
+
252
+ test 'removes the specified job' do
253
+ job_timestamp, *remaining = Resque.delayed_queue_peek(0, 10)
254
+ assert_equal 1, remaining.size
255
+
256
+ post '/delayed/cancel_now',
257
+ 'timestamp' => job_timestamp,
258
+ 'klass' => SomeIvarJob.name,
259
+ 'args' => Resque.encode(['arg'])
260
+
261
+ assert_equal 302, last_response.status
262
+ assert_equal remaining, Resque.delayed_queue_peek(0, 10)
263
+ end
264
+
265
+ test 'does not remove the job if the params do not match' do
266
+ timestamps = Resque.delayed_queue_peek(0, 10)
267
+
268
+ post '/delayed/cancel_now',
269
+ 'timestamp' => timestamps.first,
270
+ 'klass' => SomeIvarJob.name
271
+
272
+ assert_equal 302, last_response.status
273
+ assert_equal timestamps, Resque.delayed_queue_peek(0, 10)
274
+ end
242
275
 
243
276
  test 'redirects to overview' do
277
+ post '/delayed/cancel_now'
244
278
  assert last_response.status == 302
245
279
  assert last_response.header['Location'].include? '/delayed'
246
280
  end
@@ -14,7 +14,7 @@ context 'scheduling jobs with arguments' do
14
14
 
15
15
  test 'enqueue_from_config puts stuff in resque without class loaded' do
16
16
  Resque::Job.stubs(:create).once.returns(true)
17
- .with('joes_queue', 'UndefinedJob', '/tmp')
17
+ .with('joes_queue', 'UndefinedJob', '/tmp')
18
18
  Resque::Scheduler.enqueue_from_config(
19
19
  'cron' => '* * * * *',
20
20
  'class' => 'UndefinedJob',
@@ -25,7 +25,7 @@ context 'scheduling jobs with arguments' do
25
25
 
26
26
  test 'enqueue_from_config with_every_syntax' do
27
27
  Resque::Job.stubs(:create).once.returns(true)
28
- .with('james_queue', 'JamesJob', '/tmp')
28
+ .with('james_queue', 'JamesJob', '/tmp')
29
29
  Resque::Scheduler.enqueue_from_config(
30
30
  'every' => '1m',
31
31
  'class' => 'JamesJob',
@@ -36,7 +36,7 @@ context 'scheduling jobs with arguments' do
36
36
 
37
37
  test 'enqueue_from_config puts jobs in the resque queue' do
38
38
  Resque::Job.stubs(:create).once.returns(true)
39
- .with(:ivar, SomeIvarJob, '/tmp')
39
+ .with(:ivar, SomeIvarJob, '/tmp')
40
40
  Resque::Scheduler.enqueue_from_config(
41
41
  'cron' => '* * * * *',
42
42
  'class' => 'SomeIvarJob',
@@ -46,7 +46,7 @@ context 'scheduling jobs with arguments' do
46
46
 
47
47
  test 'enqueue_from_config with custom_class_job in resque' do
48
48
  FakeCustomJobClass.stubs(:scheduled).once.returns(true)
49
- .with(:ivar, 'SomeIvarJob', '/tmp')
49
+ .with(:ivar, 'SomeIvarJob', '/tmp')
50
50
  Resque::Scheduler.enqueue_from_config(
51
51
  'cron' => '* * * * *',
52
52
  'class' => 'SomeIvarJob',
@@ -207,7 +207,7 @@ context 'scheduling jobs with arguments' do
207
207
  second_key: value
208
208
  YAML
209
209
  SomeIvarJob.expects(:perform).once
210
- .with('first_key' => { 'second_key' => 'value' })
210
+ .with('first_key' => { 'second_key' => 'value' })
211
211
  Resque.reserve('ivar').perform
212
212
  end
213
213
 
@@ -442,7 +442,7 @@ context 'Resque::Scheduler' do
442
442
  test 'procline omits app_name when absent' do
443
443
  Resque::Scheduler.app_name = nil
444
444
  assert Resque::Scheduler.send(:build_procline, 'bar') =~
445
- /#{Resque::Scheduler.send(:internal_name)}: bar/
445
+ /#{Resque::Scheduler.send(:internal_name)}: bar/
446
446
  end
447
447
 
448
448
  test 'procline contains env when present' do
@@ -453,7 +453,7 @@ context 'Resque::Scheduler' do
453
453
  test 'procline omits env when absent' do
454
454
  Resque::Scheduler.env = nil
455
455
  assert Resque::Scheduler.send(:build_procline, 'cage') =~
456
- /#{Resque::Scheduler.send(:internal_name)}: cage/
456
+ /#{Resque::Scheduler.send(:internal_name)}: cage/
457
457
  end
458
458
 
459
459
  context 'printing schedule' do
@@ -464,9 +464,9 @@ context 'Resque::Scheduler' do
464
464
  test 'prints schedule' do
465
465
  fake_rufus_scheduler = mock
466
466
  fake_rufus_scheduler.expects(:jobs).at_least_once
467
- .returns(foo: OpenStruct.new(t: nil, last: nil))
467
+ .returns(foo: OpenStruct.new(t: nil, last: nil))
468
468
  Resque::Scheduler.expects(:rufus_scheduler).at_least_once
469
- .returns(fake_rufus_scheduler)
469
+ .returns(fake_rufus_scheduler)
470
470
  Resque::Scheduler.print_schedule
471
471
  end
472
472
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-scheduler
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben VandenBos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-29 00:00:00.000000000 Z
11
+ date: 2016-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 0.35.1
173
+ version: 0.40.0
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 0.35.1
180
+ version: 0.40.0
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: mono_logger
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -198,28 +198,28 @@ dependencies:
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: '3.0'
201
+ version: '3.3'
202
202
  type: :runtime
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: '3.0'
208
+ version: '3.3'
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: resque
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: '1.25'
215
+ version: '1.26'
216
216
  type: :runtime
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
- version: '1.25'
222
+ version: '1.26'
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: rufus-scheduler
225
225
  requirement: !ruby/object:Gem::Requirement
@@ -337,7 +337,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
337
337
  version: '0'
338
338
  requirements: []
339
339
  rubyforge_project:
340
- rubygems_version: 2.2.3
340
+ rubygems_version: 2.5.1
341
341
  signing_key:
342
342
  specification_version: 4
343
343
  summary: Light weight job scheduling on top of Resque
@@ -355,3 +355,4 @@ test_files:
355
355
  - test/scheduler_test.rb
356
356
  - test/test_helper.rb
357
357
  - test/util_test.rb
358
+ has_rdoc: