resque_unit 0.4.4 → 0.4.8

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: 1aad0f765a2b78da6d5f17cdbf2f5646066d8b8d
4
+ data.tar.gz: c694a2f46b3ec5892f7a83ebfae9d734dd0371ec
5
+ SHA512:
6
+ metadata.gz: 812552beeb3b8c3de00be72b6c13b8dfc4fd2808df1114f308c3eb5aaba2635108d58d9583c5a8c879248b91b716c0bf21c38fad6b2d1453a0405c272daa3f3b
7
+ data.tar.gz: 97110758541b5c3335906743fdd0dbfd2f1514106ec90ea98dbb9149bef0f86b0932974cc2ed2455d9ea119fffae551aaf9764302ab64101195f4ae3977dec8a
@@ -1,4 +1,4 @@
1
- module Resque
1
+ module ResqueUnit
2
2
  module Helpers
3
3
  # Given a Ruby object, returns a string suitable for storage in a
4
4
  # queue.
@@ -1,7 +1,7 @@
1
1
  # The fake Resque class. This needs to be loaded after the real Resque
2
2
  # for the assertions in +ResqueUnit::Assertions+ to work.
3
3
  module Resque
4
- include Helpers
4
+ include ResqueUnit::Helpers
5
5
  extend self
6
6
 
7
7
  # Resets all the queues to the empty state. This should be called in
@@ -116,7 +116,7 @@ module Resque
116
116
  def enqueue_to( queue_name, klass, *args )
117
117
  # Behaves like Resque, raise if no queue was specifed
118
118
  raise NoQueueError.new("Jobs must be placed onto a queue.") unless queue_name
119
- enqueue_unit(queue_name, {"class" => klass.name, "args" => args })
119
+ enqueue_unit(queue_name, {"class" => klass.to_s, "args" => args })
120
120
  end
121
121
 
122
122
  # :nodoc:
@@ -215,7 +215,7 @@ module Resque
215
215
  end
216
216
 
217
217
  class Job
218
- extend Helpers
218
+ extend ResqueUnit::Helpers
219
219
  def self.create(queue, klass_name, *args)
220
220
  Resque.enqueue_unit(queue, {"class" => constantize(klass_name).to_s, "args" => args})
221
221
  end
@@ -14,9 +14,8 @@ module ResqueUnit::SchedulerAssertions
14
14
  # arguments.
15
15
  def assert_queued_at(expected_timestamp, klass, args = nil, message = nil)
16
16
  queue = Resque.queue_for(klass)
17
- assert_block (message || "#{klass} should have been queued in #{queue} before #{expected_timestamp}: #{Resque.queue(queue).inspect}.") do
18
- in_timestamped_queue?(queue, expected_timestamp, klass, args)
19
- end
17
+ assert in_timestamped_queue?(queue, expected_timestamp, klass, args),
18
+ (message || "#{klass} should have been queued in #{queue} before #{expected_timestamp}: #{Resque.queue(queue).inspect}.")
20
19
  end
21
20
 
22
21
  # Similar to +assert_queued_at+, except it takes an expected time
@@ -28,9 +27,8 @@ module ResqueUnit::SchedulerAssertions
28
27
  # opposite of +assert_queued_at+
29
28
  def assert_not_queued_at(expected_timestamp, klass, args = nil, message = nil)
30
29
  queue = Resque.queue_for(klass)
31
- assert_block (message || "#{klass} should not have been queued in #{queue} before #{expected_timestamp}.") do
32
- !in_timestamped_queue?(queue, expected_timestamp, klass, args)
33
- end
30
+ assert !in_timestamped_queue?(queue, expected_timestamp, klass, args),
31
+ (message || "#{klass} should not have been queued in #{queue} before #{expected_timestamp}.")
34
32
  end
35
33
 
36
34
  # opposite of +assert_queued_in+
data/lib/resque_unit.rb CHANGED
@@ -7,12 +7,20 @@ rescue LoadError
7
7
  require 'json'
8
8
  end
9
9
 
10
- require 'test/unit/testcase'
11
10
  require 'resque_unit/helpers'
12
11
  require 'resque_unit/resque'
13
12
  require 'resque_unit/errors'
14
13
  require 'resque_unit/assertions'
15
14
  require 'resque_unit/plugin'
16
15
 
17
- Test::Unit::TestCase.send(:include, ResqueUnit::Assertions)
16
+ if defined?(Test::Unit)
17
+ Test::Unit::TestCase.send(:include, ResqueUnit::Assertions)
18
+ end
19
+
20
+ if defined?(MiniTest::Unit::TestCase)
21
+ MiniTest::Unit::TestCase.send(:include, ResqueUnit::Assertions)
22
+ end
18
23
 
24
+ if defined?(Minitest::Test)
25
+ Minitest::Test.send(:include, ResqueUnit::Assertions)
26
+ end
@@ -1,4 +1,14 @@
1
1
  require 'resque_unit/scheduler'
2
2
  require 'resque_unit/scheduler_assertions'
3
3
 
4
- Test::Unit::TestCase.send(:include, ResqueUnit::SchedulerAssertions)
4
+ if defined?(Test::Unit)
5
+ Test::Unit::TestCase.send(:include, ResqueUnit::SchedulerAssertions)
6
+ end
7
+
8
+ if defined?(MiniTest::Unit::TestCase)
9
+ MiniTest::Unit::TestCase.send(:include, ResqueUnit::SchedulerAssertions)
10
+ end
11
+
12
+ if defined?(Minitest::Test)
13
+ Minitest::Test.send(:include, ResqueUnit::SchedulerAssertions)
14
+ end
metadata CHANGED
@@ -1,62 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque_unit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
5
- prerelease:
4
+ version: 0.4.8
6
5
  platform: ruby
7
6
  authors:
8
7
  - Justin Weiss
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-07-05 00:00:00.000000000 Z
11
+ date: 2014-06-12 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: json
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: 1.4.6
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
26
  version: 1.4.6
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: bundler
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
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
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: shoulda
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
  description:
@@ -66,6 +59,8 @@ extensions: []
66
59
  extra_rdoc_files:
67
60
  - README.md
68
61
  files:
62
+ - README.md
63
+ - lib/resque_unit.rb
69
64
  - lib/resque_unit/assertions.rb
70
65
  - lib/resque_unit/errors.rb
71
66
  - lib/resque_unit/helpers.rb
@@ -73,43 +68,35 @@ files:
73
68
  - lib/resque_unit/resque.rb
74
69
  - lib/resque_unit/scheduler.rb
75
70
  - lib/resque_unit/scheduler_assertions.rb
76
- - lib/resque_unit.rb
77
71
  - lib/resque_unit_scheduler.rb
78
72
  - test/resque_test.rb
79
73
  - test/resque_unit_scheduler_test.rb
80
74
  - test/resque_unit_test.rb
81
75
  - test/sample_jobs.rb
82
76
  - test/test_helper.rb
83
- - README.md
84
77
  homepage: http://github.com/justinweiss/resque_unit
85
- licenses: []
78
+ licenses:
79
+ - MIT
80
+ metadata: {}
86
81
  post_install_message:
87
82
  rdoc_options: []
88
83
  require_paths:
89
84
  - lib
90
85
  required_ruby_version: !ruby/object:Gem::Requirement
91
- none: false
92
86
  requirements:
93
- - - ! '>='
87
+ - - ">="
94
88
  - !ruby/object:Gem::Version
95
89
  version: '0'
96
- segments:
97
- - 0
98
- hash: 2272660890872947016
99
90
  required_rubygems_version: !ruby/object:Gem::Requirement
100
- none: false
101
91
  requirements:
102
- - - ! '>='
92
+ - - ">="
103
93
  - !ruby/object:Gem::Version
104
94
  version: '0'
105
- segments:
106
- - 0
107
- hash: 2272660890872947016
108
95
  requirements: []
109
96
  rubyforge_project:
110
- rubygems_version: 1.8.24
97
+ rubygems_version: 2.2.2
111
98
  signing_key:
112
- specification_version: 3
99
+ specification_version: 4
113
100
  summary: Test::Unit support for resque job queueing
114
101
  test_files:
115
102
  - test/resque_test.rb