resque_spec 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -2
- data/Gemfile +1 -3
- data/Gemfile.lock +42 -0
- data/README.md +1 -1
- data/Rakefile +1 -3
- data/VERSION +1 -1
- data/lib/resque_spec/resque_spec.rb +13 -2
- data/resque_spec.gemspec +30 -31
- data/spec/resque_spec_spec.rb +16 -0
- metadata +74 -22
- data/.gitignore +0 -22
data/.rvmrc
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
rvm gemset use resque_spec
|
1
|
+
rvm gemset use resque_spec_v0_2_x
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
resque_spec (0.2.1)
|
5
|
+
resque (>= 1.6.0)
|
6
|
+
rspec (~> 1.3.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
git (1.2.5)
|
12
|
+
jeweler (1.5.1)
|
13
|
+
bundler (~> 1.0.0)
|
14
|
+
git (>= 1.2.5)
|
15
|
+
rake
|
16
|
+
json (1.4.6)
|
17
|
+
rack (1.2.1)
|
18
|
+
rake (0.8.7)
|
19
|
+
redis (2.1.1)
|
20
|
+
redis-namespace (0.8.0)
|
21
|
+
redis (< 3.0.0)
|
22
|
+
resque (1.10.0)
|
23
|
+
json (~> 1.4.6)
|
24
|
+
redis-namespace (~> 0.8.0)
|
25
|
+
sinatra (>= 0.9.2)
|
26
|
+
vegas (~> 0.1.2)
|
27
|
+
rspec (1.3.1)
|
28
|
+
sinatra (1.1.0)
|
29
|
+
rack (~> 1.1)
|
30
|
+
tilt (~> 1.1)
|
31
|
+
tilt (1.1)
|
32
|
+
vegas (0.1.8)
|
33
|
+
rack (>= 1.0.0)
|
34
|
+
|
35
|
+
PLATFORMS
|
36
|
+
ruby
|
37
|
+
|
38
|
+
DEPENDENCIES
|
39
|
+
jeweler (>= 1.4.0)
|
40
|
+
resque (>= 1.6.0)
|
41
|
+
resque_spec!
|
42
|
+
rspec (~> 1.3.0)
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@ ResqueSpec
|
|
2
2
|
==========
|
3
3
|
|
4
4
|
A simple RSpec and Cucumber matcher for Resque.enqueue and Resque.enqueue_at (from `ResqueScheduler`), loosely based on
|
5
|
-
[http://github.com/justinweiss/resque_unit](resque_unit).
|
5
|
+
[http://github.com/justinweiss/resque_unit](http://github.com/justinweiss/resque_unit).
|
6
6
|
|
7
7
|
This should work with Resque v1.6.0 and up and RSpec v1.3.0 and up.
|
8
8
|
|
data/Rakefile
CHANGED
@@ -11,8 +11,8 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/leshill/resque_spec"
|
12
12
|
gem.authors = ["Les Hill"]
|
13
13
|
gem.add_dependency "resque", ">= 1.6.0"
|
14
|
+
gem.add_dependency "rspec", "~> 1.3.0"
|
14
15
|
gem.add_development_dependency "jeweler", ">= 1.4.0"
|
15
|
-
gem.add_development_dependency "rspec", ">= 1.3.0"
|
16
16
|
end
|
17
17
|
Jeweler::GemcutterTasks.new
|
18
18
|
rescue LoadError
|
@@ -31,8 +31,6 @@ Spec::Rake::SpecTask.new(:rcov) do |spec|
|
|
31
31
|
spec.rcov = true
|
32
32
|
end
|
33
33
|
|
34
|
-
task :spec => :check_dependencies
|
35
|
-
|
36
34
|
task :default => :spec
|
37
35
|
|
38
36
|
require 'rake/rdoctask'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
@@ -12,8 +12,9 @@ module ResqueSpec
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def queue_name(klass)
|
15
|
-
|
16
|
-
|
15
|
+
name_from_instance_var(klass) or
|
16
|
+
name_from_queue_accessor(klass) or
|
17
|
+
raise ::Resque::NoQueueError.new("Jobs must be placed onto a queue.")
|
17
18
|
end
|
18
19
|
|
19
20
|
def queues
|
@@ -29,6 +30,16 @@ module ResqueSpec
|
|
29
30
|
ResqueSpec.queue_for(klass) << {:klass => klass, :args => args}
|
30
31
|
end
|
31
32
|
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def name_from_instance_var(klass)
|
37
|
+
klass.instance_variable_get(:@queue)
|
38
|
+
end
|
39
|
+
|
40
|
+
def name_from_queue_accessor(klass)
|
41
|
+
klass.respond_to?(:queue) and klass.queue
|
42
|
+
end
|
32
43
|
end
|
33
44
|
|
34
45
|
Resque.extend(ResqueSpec::Resque)
|
data/resque_spec.gemspec
CHANGED
@@ -1,54 +1,53 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{resque_spec}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Les Hill"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-11-24}
|
13
13
|
s.description = %q{RSpec matchers for Resque}
|
14
14
|
s.email = %q{leshill@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.md"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
21
|
+
".rvmrc",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"lib/resque_spec.rb",
|
29
|
+
"lib/resque_spec/resque_scheduler_spec.rb",
|
30
|
+
"lib/resque_spec/resque_spec.rb",
|
31
|
+
"resque_spec.gemspec",
|
32
|
+
"spec/resque_scheduler_spec_spec.rb",
|
33
|
+
"spec/resque_spec_spec.rb",
|
34
|
+
"spec/spec.opts",
|
35
|
+
"spec/spec_helper.rb",
|
36
|
+
"spec/support/account.rb",
|
37
|
+
"spec/support/address.rb",
|
38
|
+
"spec/support/person.rb"
|
39
39
|
]
|
40
40
|
s.homepage = %q{http://github.com/leshill/resque_spec}
|
41
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
42
41
|
s.require_paths = ["lib"]
|
43
42
|
s.rubygems_version = %q{1.3.7}
|
44
43
|
s.summary = %q{RSpec matchers for Resque}
|
45
44
|
s.test_files = [
|
46
45
|
"spec/resque_scheduler_spec_spec.rb",
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
46
|
+
"spec/resque_spec_spec.rb",
|
47
|
+
"spec/spec_helper.rb",
|
48
|
+
"spec/support/account.rb",
|
49
|
+
"spec/support/address.rb",
|
50
|
+
"spec/support/person.rb"
|
52
51
|
]
|
53
52
|
|
54
53
|
if s.respond_to? :specification_version then
|
@@ -57,17 +56,17 @@ Gem::Specification.new do |s|
|
|
57
56
|
|
58
57
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
59
58
|
s.add_runtime_dependency(%q<resque>, [">= 1.6.0"])
|
59
|
+
s.add_runtime_dependency(%q<rspec>, ["~> 1.3.0"])
|
60
60
|
s.add_development_dependency(%q<jeweler>, [">= 1.4.0"])
|
61
|
-
s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
|
62
61
|
else
|
63
62
|
s.add_dependency(%q<resque>, [">= 1.6.0"])
|
63
|
+
s.add_dependency(%q<rspec>, ["~> 1.3.0"])
|
64
64
|
s.add_dependency(%q<jeweler>, [">= 1.4.0"])
|
65
|
-
s.add_dependency(%q<rspec>, [">= 1.3.0"])
|
66
65
|
end
|
67
66
|
else
|
68
67
|
s.add_dependency(%q<resque>, [">= 1.6.0"])
|
68
|
+
s.add_dependency(%q<rspec>, ["~> 1.3.0"])
|
69
69
|
s.add_dependency(%q<jeweler>, [">= 1.4.0"])
|
70
|
-
s.add_dependency(%q<rspec>, [">= 1.3.0"])
|
71
70
|
end
|
72
71
|
end
|
73
72
|
|
data/spec/resque_spec_spec.rb
CHANGED
@@ -37,6 +37,22 @@ describe "ResqueSpec" do
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
describe "#queue_name" do
|
41
|
+
it "raises if there is no queue defined for a class" do
|
42
|
+
expect do
|
43
|
+
ResqueSpec.queue_name(Address)
|
44
|
+
end.should raise_error(::Resque::NoQueueError)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "returns the queue name if there is a queue defined as an instance var" do
|
48
|
+
ResqueSpec.queue_name(Person).should == :people
|
49
|
+
end
|
50
|
+
|
51
|
+
it "returns the queue name if there is a queue defined via self.queue" do
|
52
|
+
ResqueSpec.queue_name(Account).should == :people
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
40
56
|
describe "#reset!" do
|
41
57
|
it "clears the queues" do
|
42
58
|
ResqueSpec.queue_for(Person) << 'queued'
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 23
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
8
|
+
- 1
|
9
|
+
version: 0.2.1
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Les Hill
|
@@ -15,57 +14,112 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-
|
17
|
+
date: 2010-11-24 00:00:00 -05:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
|
-
name:
|
23
|
-
prerelease: false
|
21
|
+
name: resque_spec
|
24
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
23
|
none: false
|
26
24
|
requirements:
|
27
25
|
- - ">="
|
28
26
|
- !ruby/object:Gem::Version
|
29
|
-
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :runtime
|
31
|
+
prerelease: false
|
32
|
+
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: resque
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
30
40
|
segments:
|
31
41
|
- 1
|
32
42
|
- 6
|
33
43
|
- 0
|
34
44
|
version: 1.6.0
|
35
45
|
type: :runtime
|
36
|
-
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *id002
|
37
48
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
49
|
+
name: rspec
|
50
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 1
|
57
|
+
- 3
|
58
|
+
- 0
|
59
|
+
version: 1.3.0
|
60
|
+
type: :runtime
|
39
61
|
prerelease: false
|
40
|
-
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: jeweler
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
41
66
|
none: false
|
42
67
|
requirements:
|
43
68
|
- - ">="
|
44
69
|
- !ruby/object:Gem::Version
|
45
|
-
hash: 7
|
46
70
|
segments:
|
47
71
|
- 1
|
48
72
|
- 4
|
49
73
|
- 0
|
50
74
|
version: 1.4.0
|
51
75
|
type: :development
|
52
|
-
version_requirements: *id002
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: rspec
|
55
76
|
prerelease: false
|
56
|
-
|
77
|
+
version_requirements: *id004
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: resque
|
80
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
57
81
|
none: false
|
58
82
|
requirements:
|
59
83
|
- - ">="
|
60
84
|
- !ruby/object:Gem::Version
|
61
|
-
|
85
|
+
segments:
|
86
|
+
- 1
|
87
|
+
- 6
|
88
|
+
- 0
|
89
|
+
version: 1.6.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: *id005
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: rspec
|
95
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ~>
|
99
|
+
- !ruby/object:Gem::Version
|
62
100
|
segments:
|
63
101
|
- 1
|
64
102
|
- 3
|
65
103
|
- 0
|
66
104
|
version: 1.3.0
|
105
|
+
type: :runtime
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: *id006
|
108
|
+
- !ruby/object:Gem::Dependency
|
109
|
+
name: jeweler
|
110
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
segments:
|
116
|
+
- 1
|
117
|
+
- 4
|
118
|
+
- 0
|
119
|
+
version: 1.4.0
|
67
120
|
type: :development
|
68
|
-
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: *id007
|
69
123
|
description: RSpec matchers for Resque
|
70
124
|
email: leshill@gmail.com
|
71
125
|
executables: []
|
@@ -77,9 +131,9 @@ extra_rdoc_files:
|
|
77
131
|
- README.md
|
78
132
|
files:
|
79
133
|
- .document
|
80
|
-
- .gitignore
|
81
134
|
- .rvmrc
|
82
135
|
- Gemfile
|
136
|
+
- Gemfile.lock
|
83
137
|
- LICENSE
|
84
138
|
- README.md
|
85
139
|
- Rakefile
|
@@ -100,8 +154,8 @@ homepage: http://github.com/leshill/resque_spec
|
|
100
154
|
licenses: []
|
101
155
|
|
102
156
|
post_install_message:
|
103
|
-
rdoc_options:
|
104
|
-
|
157
|
+
rdoc_options: []
|
158
|
+
|
105
159
|
require_paths:
|
106
160
|
- lib
|
107
161
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -109,7 +163,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
163
|
requirements:
|
110
164
|
- - ">="
|
111
165
|
- !ruby/object:Gem::Version
|
112
|
-
hash: 3
|
113
166
|
segments:
|
114
167
|
- 0
|
115
168
|
version: "0"
|
@@ -118,7 +171,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
171
|
requirements:
|
119
172
|
- - ">="
|
120
173
|
- !ruby/object:Gem::Version
|
121
|
-
hash: 3
|
122
174
|
segments:
|
123
175
|
- 0
|
124
176
|
version: "0"
|