beanstalk-client-rspec 0.0.7 → 0.0.8
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.
- checksums.yaml +4 -4
- data/CHANGELOG.mkd +7 -0
- data/lib/beanstalk-client-rspec/version.rb +1 -1
- data/lib/beanstalk-client-rspec.rb +19 -0
- data/spec/beanstalk_spec.rb +18 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f8cfa1f6d5bcc74e0efa09c528de30ce619b754
|
4
|
+
data.tar.gz: fc0ceb569f5dd4f0ffd5aa40982bda0824b03cb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56a373b126a03b850a46d5657aa40b17e137e8744db5a8227972619bbd5f5b0594263fbd2f38e33aea1f77a01a8b85521934069a1d4014dbde3060454d796904
|
7
|
+
data.tar.gz: 02533c6429845159e78dc63c2cc14ed58b0ed76ccf4e167c25a61ad1fb19333f673cab359db9e23f59bf33f75f58db40998eff9744e19dbbd18624369459167b
|
data/CHANGELOG.mkd
CHANGED
@@ -27,6 +27,19 @@ module Beanstalk
|
|
27
27
|
self.watch(@default_tube) if @default_tube
|
28
28
|
end
|
29
29
|
|
30
|
+
# Tests use this to rest stuff
|
31
|
+
def clear!
|
32
|
+
@id_mutex = Mutex.new
|
33
|
+
@tube_mutex = Mutex.new
|
34
|
+
@tubes = {}
|
35
|
+
@id = 0
|
36
|
+
|
37
|
+
# Super reset
|
38
|
+
@mutex = Mutex.new
|
39
|
+
@tube_mutex = Mutex.new
|
40
|
+
@waiting = false
|
41
|
+
end
|
42
|
+
|
30
43
|
def connect
|
31
44
|
# We don't want to actually connect to anything
|
32
45
|
end
|
@@ -141,5 +154,11 @@ module Beanstalk
|
|
141
154
|
c.reset!
|
142
155
|
end
|
143
156
|
end
|
157
|
+
|
158
|
+
def clear!
|
159
|
+
@connections.values.each do |c|
|
160
|
+
c.clear!
|
161
|
+
end
|
162
|
+
end
|
144
163
|
end
|
145
164
|
end
|
data/spec/beanstalk_spec.rb
CHANGED
@@ -59,6 +59,24 @@ describe Beanstalk::MockPool do
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
+
describe 'clear!' do
|
63
|
+
|
64
|
+
it 'should empty tubes' do
|
65
|
+
@beanstalk.put 'cow'
|
66
|
+
@beanstalk.should have_tube_size_of(1).for('default')
|
67
|
+
@beanstalk.reset!
|
68
|
+
@beanstalk.should have_tube_size_of(0).for('default')
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should still be watching' do
|
72
|
+
@beanstalk.list_tubes_watched.values.flatten.should == ['default']
|
73
|
+
@beanstalk.watch 'foo'
|
74
|
+
@beanstalk.list_tubes_watched.values.flatten.should == ['default', 'foo']
|
75
|
+
@beanstalk.clear!
|
76
|
+
@beanstalk.list_tubes_watched.values.flatten.should == ['default', 'foo']
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
62
80
|
describe 'beanstalk workflow' do
|
63
81
|
it 'can reserve an empty tube' do
|
64
82
|
expect {
|