backgrounded 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -27,10 +27,10 @@ module Backgrounded
|
|
27
27
|
id.to_i == INVALID_ID ? clazz : clazz.find(id)
|
28
28
|
end
|
29
29
|
def instance_identifiers(object)
|
30
|
-
instance, id = if object.
|
31
|
-
[object.name, INVALID_ID]
|
32
|
-
else
|
30
|
+
instance, id = if object.kind_of?(ActiveRecord::Base)
|
33
31
|
[object.class.name, object.id]
|
32
|
+
else
|
33
|
+
[object.name, INVALID_ID]
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
data/lib/backgrounded/version.rb
CHANGED
@@ -43,6 +43,14 @@ class ResqueHandlerTest < Test::Unit::TestCase
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
module Foo
|
47
|
+
class << self
|
48
|
+
backgrounded :bar
|
49
|
+
def bar
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
46
54
|
context 'when backgrounded is configured with resque' do
|
47
55
|
setup do
|
48
56
|
Resque.reset!
|
@@ -123,5 +131,24 @@ class ResqueHandlerTest < Test::Unit::TestCase
|
|
123
131
|
end
|
124
132
|
end
|
125
133
|
end
|
134
|
+
|
135
|
+
context 'with a module backgrounded class method' do
|
136
|
+
context 'when invoking class method backgrounded' do
|
137
|
+
setup do
|
138
|
+
Foo.bar_backgrounded
|
139
|
+
end
|
140
|
+
should "enqueue job to resque" do
|
141
|
+
assert_queued Backgrounded::Resque::ResqueHandler, [Foo.to_s, -1, 'bar']
|
142
|
+
assert_equal Backgrounded::Resque::ResqueHandler::DEFAULT_QUEUE, Resque.queue_from_class(Backgrounded::Resque::ResqueHandler)
|
143
|
+
end
|
144
|
+
context 'when processing job' do
|
145
|
+
setup do
|
146
|
+
Foo.expects(:bar)
|
147
|
+
Resque.run!
|
148
|
+
end
|
149
|
+
should 'invoke module class method backgrounded' do end # see expectations
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
126
153
|
end
|
127
154
|
end
|
metadata
CHANGED
@@ -1,173 +1,122 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: backgrounded
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.5
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 7
|
9
|
-
- 4
|
10
|
-
version: 0.7.4
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Ryan Sonnek
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
22
|
-
none: false
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
hash: 23
|
27
|
-
segments:
|
28
|
-
- 2
|
29
|
-
- 3
|
30
|
-
- 10
|
31
|
-
version: 2.3.10
|
32
|
-
requirement: *id001
|
33
|
-
prerelease: false
|
12
|
+
date: 2012-06-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
34
15
|
name: activerecord
|
35
|
-
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2183008840 !ruby/object:Gem::Requirement
|
38
17
|
none: false
|
39
|
-
requirements:
|
40
|
-
- -
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
hash: 23
|
43
|
-
segments:
|
44
|
-
- 2
|
45
|
-
- 3
|
46
|
-
- 10
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
47
21
|
version: 2.3.10
|
48
|
-
|
22
|
+
type: :runtime
|
49
23
|
prerelease: false
|
24
|
+
version_requirements: *2183008840
|
25
|
+
- !ruby/object:Gem::Dependency
|
50
26
|
name: activesupport
|
51
|
-
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
27
|
+
requirement: &2183008320 !ruby/object:Gem::Requirement
|
54
28
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
|
60
|
-
- 0
|
61
|
-
version: "0"
|
62
|
-
requirement: *id003
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.3.10
|
33
|
+
type: :runtime
|
63
34
|
prerelease: false
|
35
|
+
version_requirements: *2183008320
|
36
|
+
- !ruby/object:Gem::Dependency
|
64
37
|
name: shoulda
|
65
|
-
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
|
-
version_requirements: &id004 !ruby/object:Gem::Requirement
|
38
|
+
requirement: &2183007840 !ruby/object:Gem::Requirement
|
68
39
|
none: false
|
69
|
-
requirements:
|
70
|
-
- -
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
|
73
|
-
|
74
|
-
- 0
|
75
|
-
- 17
|
76
|
-
- 1
|
77
|
-
version: 0.17.1
|
78
|
-
requirement: *id004
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
79
45
|
prerelease: false
|
46
|
+
version_requirements: *2183007840
|
47
|
+
- !ruby/object:Gem::Dependency
|
80
48
|
name: resque
|
81
|
-
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
version_requirements: &id005 !ruby/object:Gem::Requirement
|
49
|
+
requirement: &2183007360 !ruby/object:Gem::Requirement
|
84
50
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
|
89
|
-
|
90
|
-
- 0
|
91
|
-
- 3
|
92
|
-
- 7
|
93
|
-
version: 0.3.7
|
94
|
-
requirement: *id005
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.17.1
|
55
|
+
type: :development
|
95
56
|
prerelease: false
|
57
|
+
version_requirements: *2183007360
|
58
|
+
- !ruby/object:Gem::Dependency
|
96
59
|
name: resque_unit
|
97
|
-
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
version_requirements: &id006 !ruby/object:Gem::Requirement
|
60
|
+
requirement: &2183006880 !ruby/object:Gem::Requirement
|
100
61
|
none: false
|
101
|
-
requirements:
|
102
|
-
- -
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
|
105
|
-
|
106
|
-
- 0
|
107
|
-
version: "0"
|
108
|
-
requirement: *id006
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.3.7
|
66
|
+
type: :development
|
109
67
|
prerelease: false
|
68
|
+
version_requirements: *2183006880
|
69
|
+
- !ruby/object:Gem::Dependency
|
110
70
|
name: mocha
|
111
|
-
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
version_requirements: &id007 !ruby/object:Gem::Requirement
|
71
|
+
requirement: &2183006400 !ruby/object:Gem::Requirement
|
114
72
|
none: false
|
115
|
-
requirements:
|
116
|
-
- -
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
|
119
|
-
|
120
|
-
- 1
|
121
|
-
- 3
|
122
|
-
- 2
|
123
|
-
version: 1.3.2
|
124
|
-
requirement: *id007
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
125
78
|
prerelease: false
|
79
|
+
version_requirements: *2183006400
|
80
|
+
- !ruby/object:Gem::Dependency
|
126
81
|
name: sqlite3-ruby
|
127
|
-
|
128
|
-
- !ruby/object:Gem::Dependency
|
129
|
-
version_requirements: &id008 !ruby/object:Gem::Requirement
|
82
|
+
requirement: &2183005920 !ruby/object:Gem::Requirement
|
130
83
|
none: false
|
131
|
-
requirements:
|
132
|
-
- -
|
133
|
-
- !ruby/object:Gem::Version
|
134
|
-
|
135
|
-
|
136
|
-
- 2
|
137
|
-
- 1
|
138
|
-
- 4
|
139
|
-
version: 2.1.4
|
140
|
-
requirement: *id008
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 1.3.2
|
88
|
+
type: :development
|
141
89
|
prerelease: false
|
90
|
+
version_requirements: *2183005920
|
91
|
+
- !ruby/object:Gem::Dependency
|
142
92
|
name: delayed_job
|
143
|
-
|
144
|
-
- !ruby/object:Gem::Dependency
|
145
|
-
version_requirements: &id009 !ruby/object:Gem::Requirement
|
93
|
+
requirement: &2183005440 !ruby/object:Gem::Requirement
|
146
94
|
none: false
|
147
|
-
requirements:
|
148
|
-
- -
|
149
|
-
- !ruby/object:Gem::Version
|
150
|
-
|
151
|
-
|
152
|
-
- 0
|
153
|
-
- 9
|
154
|
-
- 2
|
155
|
-
- 2
|
156
|
-
version: 0.9.2.2
|
157
|
-
requirement: *id009
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 2.1.4
|
99
|
+
type: :development
|
158
100
|
prerelease: false
|
101
|
+
version_requirements: *2183005440
|
102
|
+
- !ruby/object:Gem::Dependency
|
159
103
|
name: rake
|
104
|
+
requirement: &2183004960 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.9.2.2
|
160
110
|
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *2183004960
|
161
113
|
description: Execute any ActiveRecord Model method in the background
|
162
|
-
email:
|
114
|
+
email:
|
163
115
|
- ryan@codecrate.com
|
164
116
|
executables: []
|
165
|
-
|
166
117
|
extensions: []
|
167
|
-
|
168
118
|
extra_rdoc_files: []
|
169
|
-
|
170
|
-
files:
|
119
|
+
files:
|
171
120
|
- .gitignore
|
172
121
|
- .rvmrc
|
173
122
|
- Gemfile
|
@@ -192,38 +141,35 @@ files:
|
|
192
141
|
- test/test_helper.rb
|
193
142
|
homepage: http://github.com/wireframe/backgrounded
|
194
143
|
licenses: []
|
195
|
-
|
196
144
|
post_install_message:
|
197
145
|
rdoc_options: []
|
198
|
-
|
199
|
-
require_paths:
|
146
|
+
require_paths:
|
200
147
|
- lib
|
201
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
148
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
202
149
|
none: false
|
203
|
-
requirements:
|
204
|
-
- -
|
205
|
-
- !ruby/object:Gem::Version
|
206
|
-
|
207
|
-
segments:
|
150
|
+
requirements:
|
151
|
+
- - ! '>='
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
segments:
|
208
155
|
- 0
|
209
|
-
|
210
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
+
hash: -49604688935868797
|
157
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
158
|
none: false
|
212
|
-
requirements:
|
213
|
-
- -
|
214
|
-
- !ruby/object:Gem::Version
|
215
|
-
|
216
|
-
segments:
|
159
|
+
requirements:
|
160
|
+
- - ! '>='
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '0'
|
163
|
+
segments:
|
217
164
|
- 0
|
218
|
-
|
165
|
+
hash: -49604688935868797
|
219
166
|
requirements: []
|
220
|
-
|
221
167
|
rubyforge_project: backgrounded
|
222
|
-
rubygems_version: 1.8.
|
168
|
+
rubygems_version: 1.8.15
|
223
169
|
signing_key:
|
224
170
|
specification_version: 3
|
225
171
|
summary: Simple API to run Model methods in the background
|
226
|
-
test_files:
|
172
|
+
test_files:
|
227
173
|
- test/backgrounded/handler/delayed_job_handler_test.rb
|
228
174
|
- test/backgrounded/handler/resque_handler_test.rb
|
229
175
|
- test/backgrounded/handler/workling_handler_test.rb
|