backgrounded-resque 2.0.0.rc2 → 2.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
data/backgrounded.gemspec CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency(%q<mocha>, [">= 0"])
22
22
  s.add_development_dependency(%q<sqlite3-ruby>, [">= 1.3.2"])
23
23
  s.add_development_dependency(%q<rake>, [">= 0.9.2.2"])
24
+ s.add_development_dependency(%q<pry>, [">= 0.9.9.6"])
24
25
 
25
26
  s.files = `git ls-files`.split("\n")
26
27
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -7,16 +7,20 @@ module Backgrounded
7
7
  class ResqueHandler < Backgrounded::Handler::AbstractHandler
8
8
  DEFAULT_QUEUE = 'backgrounded'
9
9
  INVALID_ID = -1
10
- @@queue = DEFAULT_QUEUE
11
10
 
11
+ # resque uses this attribute to determine what queue the job belongs in
12
+ # @see Resque.queue_from_class
13
+ class_attribute :queue
14
+ self.queue = DEFAULT_QUEUE
15
+
16
+ # enqueue the requested operation into resque
17
+ # the resque worker will invoke .perform with the class/method/args
18
+ # @see .perform
12
19
  def request(object, method, args)
13
- @@queue = options[:queue] || DEFAULT_QUEUE
20
+ ResqueHandler.queue = options[:queue] || DEFAULT_QUEUE
14
21
  instance, id = instance_identifiers(object)
15
22
  ::Resque.enqueue(ResqueHandler, instance, id, method, *args)
16
23
  end
17
- def self.queue
18
- @@queue
19
- end
20
24
 
21
25
  # invoke the requested method
22
26
  # fired from the resque workers
@@ -1,5 +1,5 @@
1
1
  module Backgrounded
2
2
  module Resque
3
- VERSION = "2.0.0.rc2"
3
+ VERSION = "2.0.0.rc3"
4
4
  end
5
5
  end
@@ -35,6 +35,15 @@ class ResqueHandlerTest < Test::Unit::TestCase
35
35
  end
36
36
  end
37
37
 
38
+ context '.queue' do
39
+ should "default to #{Backgrounded::Resque::ResqueHandler::DEFAULT_QUEUE}" do
40
+ assert_equal Backgrounded::Resque::ResqueHandler::DEFAULT_QUEUE, Backgrounded::Resque::ResqueHandler.queue
41
+ end
42
+ should 'be used by resque to determine job queue' do
43
+ assert_equal Backgrounded::Resque::ResqueHandler::DEFAULT_QUEUE, Resque.queue_from_class(Backgrounded::Resque::ResqueHandler)
44
+ end
45
+ end
46
+
38
47
  context 'when backgrounded is configured with resque' do
39
48
  setup do
40
49
  Resque.reset!
data/test/test_helper.rb CHANGED
@@ -11,6 +11,7 @@ require 'test/unit'
11
11
  require 'shoulda'
12
12
  require 'mocha'
13
13
  require 'active_record'
14
+ require 'pry'
14
15
 
15
16
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
16
17
  $LOAD_PATH.unshift(File.dirname(__FILE__))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backgrounded-resque
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc2
4
+ version: 2.0.0.rc3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-05-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: backgrounded
16
- requirement: &2175063400 !ruby/object:Gem::Requirement
16
+ requirement: &2178255200 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.0.0.rc2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2175063400
24
+ version_requirements: *2178255200
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: resque
27
- requirement: &2175062880 !ruby/object:Gem::Requirement
27
+ requirement: &2178254680 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.17.1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2175062880
35
+ version_requirements: *2178254680
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: shoulda
38
- requirement: &2175062400 !ruby/object:Gem::Requirement
38
+ requirement: &2178254200 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2175062400
46
+ version_requirements: *2178254200
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: resque_unit
49
- requirement: &2175061920 !ruby/object:Gem::Requirement
49
+ requirement: &2178253720 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.3.7
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2175061920
57
+ version_requirements: *2178253720
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: mocha
60
- requirement: &2175061440 !ruby/object:Gem::Requirement
60
+ requirement: &2178253240 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2175061440
68
+ version_requirements: *2178253240
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sqlite3-ruby
71
- requirement: &2175060960 !ruby/object:Gem::Requirement
71
+ requirement: &2178252760 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.3.2
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2175060960
79
+ version_requirements: *2178252760
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rake
82
- requirement: &2175060480 !ruby/object:Gem::Requirement
82
+ requirement: &2178252280 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,18 @@ dependencies:
87
87
  version: 0.9.2.2
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2175060480
90
+ version_requirements: *2178252280
91
+ - !ruby/object:Gem::Dependency
92
+ name: pry
93
+ requirement: &2178251800 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: 0.9.9.6
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *2178251800
91
102
  description: Execute any ActiveRecord Model method in the background
92
103
  email:
93
104
  - ryan@codecrate.com
@@ -123,7 +134,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
134
  version: '0'
124
135
  segments:
125
136
  - 0
126
- hash: -1104768520332548292
137
+ hash: 2200823803224413559
127
138
  required_rubygems_version: !ruby/object:Gem::Requirement
128
139
  none: false
129
140
  requirements: