resque_spec 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +3 -18
- data/lib/resque_spec/resque_scheduler_spec.rb +1 -1
- data/lib/resque_spec/version.rb +3 -0
- metadata +17 -55
- data/.document +0 -5
- data/.gitignore +0 -22
- data/.rspec +0 -2
- data/.rvmrc +0 -2
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -53
- data/VERSION +0 -1
- data/resque_spec.gemspec +0 -74
- data/spec/resque_scheduler_spec_spec.rb +0 -114
- data/spec/resque_spec_spec.rb +0 -122
- data/spec/spec_helper.rb +0 -9
- data/spec/support/account.rb +0 -5
- data/spec/support/address.rb +0 -3
- data/spec/support/person.rb +0 -3
data/Rakefile
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
gem.name = "resque_spec"
|
|
5
|
-
gem.summary = %{RSpec matchers for Resque}
|
|
6
|
-
gem.description = %{RSpec matchers for Resque}
|
|
7
|
-
gem.email = "leshill@gmail.com"
|
|
8
|
-
gem.homepage = "http://github.com/leshill/resque_spec"
|
|
9
|
-
gem.authors = ["Les Hill"]
|
|
10
|
-
gem.add_dependency "resque", ">= 1.6.0"
|
|
11
|
-
gem.add_dependency "rspec", ">= 2.0.0.beta.12"
|
|
12
|
-
gem.add_development_dependency "jeweler", ">= 1.4.0"
|
|
13
|
-
end
|
|
14
|
-
Jeweler::GemcutterTasks.new
|
|
15
|
-
rescue LoadError
|
|
16
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
|
1
|
+
task :gem => :build
|
|
2
|
+
task :build do
|
|
3
|
+
system "gem build resque_spec.gemspec"
|
|
17
4
|
end
|
|
18
5
|
|
|
19
6
|
require 'rspec/core/rake_task'
|
|
@@ -26,8 +13,6 @@ RSpec::Core::RakeTask.new(:rcov) do |spec|
|
|
|
26
13
|
spec.rcov = true
|
|
27
14
|
end
|
|
28
15
|
|
|
29
|
-
task :spec => :check_dependencies
|
|
30
|
-
|
|
31
16
|
task :default => :spec
|
|
32
17
|
|
|
33
18
|
require 'rake/rdoctask'
|
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: 15
|
|
5
4
|
prerelease: false
|
|
6
5
|
segments:
|
|
7
6
|
- 0
|
|
8
7
|
- 4
|
|
9
|
-
-
|
|
10
|
-
version: 0.4.
|
|
8
|
+
- 1
|
|
9
|
+
version: 0.4.1
|
|
11
10
|
platform: ruby
|
|
12
11
|
authors:
|
|
13
12
|
- Les Hill
|
|
@@ -15,7 +14,7 @@ autorequire:
|
|
|
15
14
|
bindir: bin
|
|
16
15
|
cert_chain: []
|
|
17
16
|
|
|
18
|
-
date: 2010-
|
|
17
|
+
date: 2010-11-28 00:00:00 -05:00
|
|
19
18
|
default_executable:
|
|
20
19
|
dependencies:
|
|
21
20
|
- !ruby/object:Gem::Dependency
|
|
@@ -26,7 +25,6 @@ dependencies:
|
|
|
26
25
|
requirements:
|
|
27
26
|
- - ">="
|
|
28
27
|
- !ruby/object:Gem::Version
|
|
29
|
-
hash: 15
|
|
30
28
|
segments:
|
|
31
29
|
- 1
|
|
32
30
|
- 6
|
|
@@ -42,7 +40,6 @@ dependencies:
|
|
|
42
40
|
requirements:
|
|
43
41
|
- - ">="
|
|
44
42
|
- !ruby/object:Gem::Version
|
|
45
|
-
hash: 62196475
|
|
46
43
|
segments:
|
|
47
44
|
- 2
|
|
48
45
|
- 0
|
|
@@ -52,59 +49,29 @@ dependencies:
|
|
|
52
49
|
version: 2.0.0.beta.12
|
|
53
50
|
type: :runtime
|
|
54
51
|
version_requirements: *id002
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: jeweler
|
|
57
|
-
prerelease: false
|
|
58
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
|
59
|
-
none: false
|
|
60
|
-
requirements:
|
|
61
|
-
- - ">="
|
|
62
|
-
- !ruby/object:Gem::Version
|
|
63
|
-
hash: 7
|
|
64
|
-
segments:
|
|
65
|
-
- 1
|
|
66
|
-
- 4
|
|
67
|
-
- 0
|
|
68
|
-
version: 1.4.0
|
|
69
|
-
type: :development
|
|
70
|
-
version_requirements: *id003
|
|
71
52
|
description: RSpec matchers for Resque
|
|
72
53
|
email: leshill@gmail.com
|
|
73
54
|
executables: []
|
|
74
55
|
|
|
75
56
|
extensions: []
|
|
76
57
|
|
|
77
|
-
extra_rdoc_files:
|
|
78
|
-
|
|
79
|
-
- README.md
|
|
58
|
+
extra_rdoc_files: []
|
|
59
|
+
|
|
80
60
|
files:
|
|
81
|
-
- .
|
|
82
|
-
- .
|
|
83
|
-
- .
|
|
84
|
-
- .
|
|
85
|
-
- Gemfile
|
|
86
|
-
- Gemfile.lock
|
|
61
|
+
- lib/resque_spec/resque_scheduler_spec.rb
|
|
62
|
+
- lib/resque_spec/resque_spec.rb
|
|
63
|
+
- lib/resque_spec/version.rb
|
|
64
|
+
- lib/resque_spec.rb
|
|
87
65
|
- LICENSE
|
|
88
66
|
- README.md
|
|
89
67
|
- Rakefile
|
|
90
|
-
- VERSION
|
|
91
|
-
- lib/resque_spec.rb
|
|
92
|
-
- lib/resque_spec/resque_scheduler_spec.rb
|
|
93
|
-
- lib/resque_spec/resque_spec.rb
|
|
94
|
-
- resque_spec.gemspec
|
|
95
|
-
- spec/resque_scheduler_spec_spec.rb
|
|
96
|
-
- spec/resque_spec_spec.rb
|
|
97
|
-
- spec/spec_helper.rb
|
|
98
|
-
- spec/support/account.rb
|
|
99
|
-
- spec/support/address.rb
|
|
100
|
-
- spec/support/person.rb
|
|
101
68
|
has_rdoc: true
|
|
102
69
|
homepage: http://github.com/leshill/resque_spec
|
|
103
70
|
licenses: []
|
|
104
71
|
|
|
105
72
|
post_install_message:
|
|
106
|
-
rdoc_options:
|
|
107
|
-
|
|
73
|
+
rdoc_options: []
|
|
74
|
+
|
|
108
75
|
require_paths:
|
|
109
76
|
- lib
|
|
110
77
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
@@ -112,7 +79,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
112
79
|
requirements:
|
|
113
80
|
- - ">="
|
|
114
81
|
- !ruby/object:Gem::Version
|
|
115
|
-
hash: 3
|
|
116
82
|
segments:
|
|
117
83
|
- 0
|
|
118
84
|
version: "0"
|
|
@@ -121,10 +87,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
121
87
|
requirements:
|
|
122
88
|
- - ">="
|
|
123
89
|
- !ruby/object:Gem::Version
|
|
124
|
-
hash: 3
|
|
125
90
|
segments:
|
|
126
|
-
-
|
|
127
|
-
|
|
91
|
+
- 1
|
|
92
|
+
- 3
|
|
93
|
+
- 6
|
|
94
|
+
version: 1.3.6
|
|
128
95
|
requirements: []
|
|
129
96
|
|
|
130
97
|
rubyforge_project:
|
|
@@ -132,10 +99,5 @@ rubygems_version: 1.3.7
|
|
|
132
99
|
signing_key:
|
|
133
100
|
specification_version: 3
|
|
134
101
|
summary: RSpec matchers for Resque
|
|
135
|
-
test_files:
|
|
136
|
-
|
|
137
|
-
- spec/resque_spec_spec.rb
|
|
138
|
-
- spec/spec_helper.rb
|
|
139
|
-
- spec/support/account.rb
|
|
140
|
-
- spec/support/address.rb
|
|
141
|
-
- spec/support/person.rb
|
|
102
|
+
test_files: []
|
|
103
|
+
|
data/.document
DELETED
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rvmrc
DELETED
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
resque_spec (0.3.1)
|
|
5
|
-
resque (>= 1.6.0)
|
|
6
|
-
rspec (>= 2.0.0.beta.12)
|
|
7
|
-
|
|
8
|
-
GEM
|
|
9
|
-
remote: http://rubygems.org/
|
|
10
|
-
specs:
|
|
11
|
-
diff-lcs (1.1.2)
|
|
12
|
-
gemcutter (0.6.1)
|
|
13
|
-
git (1.2.5)
|
|
14
|
-
jeweler (1.4.0)
|
|
15
|
-
gemcutter (>= 0.1.0)
|
|
16
|
-
git (>= 1.2.5)
|
|
17
|
-
rubyforge (>= 2.0.0)
|
|
18
|
-
json (1.4.6)
|
|
19
|
-
json_pure (1.4.6)
|
|
20
|
-
rack (1.2.1)
|
|
21
|
-
redis (2.0.8)
|
|
22
|
-
redis-namespace (0.8.0)
|
|
23
|
-
redis (< 3.0.0)
|
|
24
|
-
resque (1.10.0)
|
|
25
|
-
json (~> 1.4.6)
|
|
26
|
-
redis-namespace (~> 0.8.0)
|
|
27
|
-
sinatra (>= 0.9.2)
|
|
28
|
-
vegas (~> 0.1.2)
|
|
29
|
-
rspec (2.0.0.beta.22)
|
|
30
|
-
rspec-core (= 2.0.0.beta.22)
|
|
31
|
-
rspec-expectations (= 2.0.0.beta.22)
|
|
32
|
-
rspec-mocks (= 2.0.0.beta.22)
|
|
33
|
-
rspec-core (2.0.0.beta.22)
|
|
34
|
-
rspec-expectations (2.0.0.beta.22)
|
|
35
|
-
diff-lcs (>= 1.1.2)
|
|
36
|
-
rspec-mocks (2.0.0.beta.22)
|
|
37
|
-
rspec-core (= 2.0.0.beta.22)
|
|
38
|
-
rspec-expectations (= 2.0.0.beta.22)
|
|
39
|
-
rubyforge (2.0.4)
|
|
40
|
-
json_pure (>= 1.1.7)
|
|
41
|
-
sinatra (1.0)
|
|
42
|
-
rack (>= 1.0)
|
|
43
|
-
vegas (0.1.7)
|
|
44
|
-
rack (>= 1.0.0)
|
|
45
|
-
|
|
46
|
-
PLATFORMS
|
|
47
|
-
ruby
|
|
48
|
-
|
|
49
|
-
DEPENDENCIES
|
|
50
|
-
jeweler (>= 1.4.0)
|
|
51
|
-
resque (>= 1.6.0)
|
|
52
|
-
resque_spec!
|
|
53
|
-
rspec (>= 2.0.0.beta.12)
|
data/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.4.0
|
data/resque_spec.gemspec
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# Generated by jeweler
|
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
|
4
|
-
# -*- encoding: utf-8 -*-
|
|
5
|
-
|
|
6
|
-
Gem::Specification.new do |s|
|
|
7
|
-
s.name = %q{resque_spec}
|
|
8
|
-
s.version = "0.4.0"
|
|
9
|
-
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
|
-
s.authors = ["Les Hill"]
|
|
12
|
-
s.date = %q{2010-09-16}
|
|
13
|
-
s.description = %q{RSpec matchers for Resque}
|
|
14
|
-
s.email = %q{leshill@gmail.com}
|
|
15
|
-
s.extra_rdoc_files = [
|
|
16
|
-
"LICENSE",
|
|
17
|
-
"README.md"
|
|
18
|
-
]
|
|
19
|
-
s.files = [
|
|
20
|
-
".document",
|
|
21
|
-
".gitignore",
|
|
22
|
-
".rspec",
|
|
23
|
-
".rvmrc",
|
|
24
|
-
"Gemfile",
|
|
25
|
-
"Gemfile.lock",
|
|
26
|
-
"LICENSE",
|
|
27
|
-
"README.md",
|
|
28
|
-
"Rakefile",
|
|
29
|
-
"VERSION",
|
|
30
|
-
"lib/resque_spec.rb",
|
|
31
|
-
"lib/resque_spec/resque_scheduler_spec.rb",
|
|
32
|
-
"lib/resque_spec/resque_spec.rb",
|
|
33
|
-
"resque_spec.gemspec",
|
|
34
|
-
"spec/resque_scheduler_spec_spec.rb",
|
|
35
|
-
"spec/resque_spec_spec.rb",
|
|
36
|
-
"spec/spec_helper.rb",
|
|
37
|
-
"spec/support/account.rb",
|
|
38
|
-
"spec/support/address.rb",
|
|
39
|
-
"spec/support/person.rb"
|
|
40
|
-
]
|
|
41
|
-
s.homepage = %q{http://github.com/leshill/resque_spec}
|
|
42
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
|
43
|
-
s.require_paths = ["lib"]
|
|
44
|
-
s.rubygems_version = %q{1.3.7}
|
|
45
|
-
s.summary = %q{RSpec matchers for Resque}
|
|
46
|
-
s.test_files = [
|
|
47
|
-
"spec/resque_scheduler_spec_spec.rb",
|
|
48
|
-
"spec/resque_spec_spec.rb",
|
|
49
|
-
"spec/spec_helper.rb",
|
|
50
|
-
"spec/support/account.rb",
|
|
51
|
-
"spec/support/address.rb",
|
|
52
|
-
"spec/support/person.rb"
|
|
53
|
-
]
|
|
54
|
-
|
|
55
|
-
if s.respond_to? :specification_version then
|
|
56
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
57
|
-
s.specification_version = 3
|
|
58
|
-
|
|
59
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
60
|
-
s.add_runtime_dependency(%q<resque>, [">= 1.6.0"])
|
|
61
|
-
s.add_runtime_dependency(%q<rspec>, [">= 2.0.0.beta.12"])
|
|
62
|
-
s.add_development_dependency(%q<jeweler>, [">= 1.4.0"])
|
|
63
|
-
else
|
|
64
|
-
s.add_dependency(%q<resque>, [">= 1.6.0"])
|
|
65
|
-
s.add_dependency(%q<rspec>, [">= 2.0.0.beta.12"])
|
|
66
|
-
s.add_dependency(%q<jeweler>, [">= 1.4.0"])
|
|
67
|
-
end
|
|
68
|
-
else
|
|
69
|
-
s.add_dependency(%q<resque>, [">= 1.6.0"])
|
|
70
|
-
s.add_dependency(%q<rspec>, [">= 2.0.0.beta.12"])
|
|
71
|
-
s.add_dependency(%q<jeweler>, [">= 1.4.0"])
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe "ResqueSchedulerSpec" do
|
|
4
|
-
before do
|
|
5
|
-
ResqueSpec.reset!
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
let(:first_name) { 'Les' }
|
|
9
|
-
let(:last_name) { 'Hill' }
|
|
10
|
-
let(:scheduled_at) { Time.now + 5 * 60 }
|
|
11
|
-
|
|
12
|
-
describe "scheduled?" do
|
|
13
|
-
it "returns true if the arguments were queued" do
|
|
14
|
-
Resque.enqueue_at(scheduled_at, Person, first_name, last_name)
|
|
15
|
-
ResqueSpec.scheduled?(Person, scheduled_at, first_name, last_name).should be
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it "returns false if the arguments were not queued" do
|
|
19
|
-
ResqueSpec.scheduled?(Person, scheduled_at, first_name, last_name).should_not be
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
describe "scheduled_anytime?" do
|
|
24
|
-
it "returns true if the arguments were queued" do
|
|
25
|
-
Resque.enqueue_at(scheduled_at, Person, first_name, last_name)
|
|
26
|
-
ResqueSpec.scheduled_anytime?(Person, first_name, last_name).should be
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
it "returns false if the arguments were not queued" do
|
|
30
|
-
ResqueSpec.scheduled_anytime?(Person, first_name, last_name).should_not be
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
describe "#schedule_for" do
|
|
35
|
-
it "raises if there is no schedule queue defined for a class" do
|
|
36
|
-
expect do
|
|
37
|
-
ResqueSpec.schedule_for(Address)
|
|
38
|
-
end.should raise_error(::Resque::NoQueueError)
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it "recognizes a queue defined as a class instance variable" do
|
|
42
|
-
expect do
|
|
43
|
-
ResqueSpec.schedule_for(Person)
|
|
44
|
-
end.should_not raise_error(::Resque::NoQueueError)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it "recognizes a queue defined as a class method" do
|
|
48
|
-
expect do
|
|
49
|
-
ResqueSpec.schedule_for(Account)
|
|
50
|
-
end.should_not raise_error(::Resque::NoQueueError)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it "has an empty array if nothing queued for a class" do
|
|
54
|
-
ResqueSpec.schedule_for(Person).should == []
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
it "allows additions" do
|
|
58
|
-
ResqueSpec.schedule_for(Person) << 'queued'
|
|
59
|
-
ResqueSpec.schedule_for(Person).should_not be_empty
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
describe "Resque" do
|
|
64
|
-
describe "#enqueue_at" do
|
|
65
|
-
|
|
66
|
-
before do
|
|
67
|
-
Resque.enqueue_at(scheduled_at, Person, first_name, last_name)
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
it "adds to the scheduled queue hash" do
|
|
71
|
-
ResqueSpec.schedule_for(Person).should_not be_empty
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
it "sets the klass on the queue" do
|
|
75
|
-
ResqueSpec.schedule_for(Person).first.should include(:klass => Person)
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
it "sets the arguments on the queue" do
|
|
79
|
-
ResqueSpec.schedule_for(Person).first.should include(:args => [first_name, last_name])
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
it "sets the time on the scheduled queue" do
|
|
83
|
-
ResqueSpec.schedule_for(Person).first.should include(:time => scheduled_at)
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
context "Matchers" do
|
|
90
|
-
before do
|
|
91
|
-
Resque.enqueue_at(scheduled_at, Person, first_name, last_name)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
describe "#have_scheduled_at" do
|
|
95
|
-
it "returns true if the arguments are found in the queue" do
|
|
96
|
-
Person.should have_scheduled_at(scheduled_at, first_name, last_name)
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
it "returns false if the arguments are not found in the queue" do
|
|
100
|
-
Person.should_not have_scheduled_at(scheduled_at, last_name, first_name)
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
describe "#have_scheduled" do
|
|
105
|
-
it "returns true if the arguments are found in the queue" do
|
|
106
|
-
Person.should have_scheduled(first_name, last_name)
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
it "returns false if the arguments are not found in the queue" do
|
|
110
|
-
Person.should_not have_scheduled(last_name, first_name)
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
end
|
data/spec/resque_spec_spec.rb
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe "ResqueSpec" do
|
|
4
|
-
before do
|
|
5
|
-
ResqueSpec.reset!
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
let(:first_name) { 'Les' }
|
|
9
|
-
let(:last_name) { 'Hill' }
|
|
10
|
-
|
|
11
|
-
describe "#queue_for" do
|
|
12
|
-
it "raises if there is no queue defined for a class" do
|
|
13
|
-
expect do
|
|
14
|
-
ResqueSpec.queue_for(Address)
|
|
15
|
-
end.should raise_error(::Resque::NoQueueError)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it "recognizes a queue defined as a class instance variable" do
|
|
19
|
-
expect do
|
|
20
|
-
ResqueSpec.queue_for(Person)
|
|
21
|
-
end.should_not raise_error(::Resque::NoQueueError)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
it "recognizes a queue defined as a class method" do
|
|
25
|
-
expect do
|
|
26
|
-
ResqueSpec.queue_for(Account)
|
|
27
|
-
end.should_not raise_error(::Resque::NoQueueError)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it "has an empty array if nothing queued for a class" do
|
|
31
|
-
ResqueSpec.queue_for(Person).should == []
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it "allows additions" do
|
|
35
|
-
ResqueSpec.queue_for(Person) << 'queued'
|
|
36
|
-
ResqueSpec.queue_for(Person).should_not be_empty
|
|
37
|
-
end
|
|
38
|
-
end
|
|
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
|
-
|
|
56
|
-
describe "#queue_size" do
|
|
57
|
-
|
|
58
|
-
before { 3.times { ResqueSpec.queue_for(Account) << 'queued' }}
|
|
59
|
-
subject { ResqueSpec.queue_size(Account) }
|
|
60
|
-
it { should == 3 }
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
describe "#reset!" do
|
|
64
|
-
it "clears the queues" do
|
|
65
|
-
ResqueSpec.queue_for(Person) << 'queued'
|
|
66
|
-
ResqueSpec.reset!
|
|
67
|
-
ResqueSpec.queues.should be_empty
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
describe "in_queue?" do
|
|
72
|
-
|
|
73
|
-
it "returns true if the arguments were queued" do
|
|
74
|
-
Resque.enqueue(Person, first_name, last_name)
|
|
75
|
-
ResqueSpec.in_queue?(Person, first_name, last_name).should be
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
it "returns false if the arguments were not queued" do
|
|
79
|
-
ResqueSpec.in_queue?(Person, first_name, last_name).should_not be
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
describe "Resque" do
|
|
85
|
-
describe "#enqueue" do
|
|
86
|
-
|
|
87
|
-
before do
|
|
88
|
-
Resque.enqueue(Person, first_name, last_name)
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
it "adds to the queue hash" do
|
|
92
|
-
ResqueSpec.queue_for(Person).should_not be_empty
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
it "sets the klass on the queue" do
|
|
96
|
-
ResqueSpec.queue_for(Person).first.should include(:klass => Person)
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
it "sets the arguments on the queue" do
|
|
100
|
-
ResqueSpec.queue_for(Person).first.should include(:args => [first_name, last_name])
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
context "Matchers" do
|
|
107
|
-
before do
|
|
108
|
-
Resque.enqueue(Person, first_name, last_name)
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
subject { Person }
|
|
112
|
-
|
|
113
|
-
describe "#have_queued" do
|
|
114
|
-
it { should have_queued(first_name, last_name) }
|
|
115
|
-
it { should_not have_queued(last_name, first_name) }
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
describe "#have_queue_size_of" do
|
|
119
|
-
it { should have_queue_size_of(1) }
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
end
|
data/spec/spec_helper.rb
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
2
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
3
|
-
require 'rspec'
|
|
4
|
-
require 'resque_spec'
|
|
5
|
-
|
|
6
|
-
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
|
|
7
|
-
|
|
8
|
-
RSpec.configure do |config|
|
|
9
|
-
end
|
data/spec/support/account.rb
DELETED
data/spec/support/address.rb
DELETED
data/spec/support/person.rb
DELETED