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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 41ec535758e29a12880881ce1c73715e2738fd4b
4
- data.tar.gz: 9d07f313ab3eaeff420b537b5f5093a79a44b8ff
3
+ metadata.gz: 6f8cfa1f6d5bcc74e0efa09c528de30ce619b754
4
+ data.tar.gz: fc0ceb569f5dd4f0ffd5aa40982bda0824b03cb9
5
5
  SHA512:
6
- metadata.gz: 2f1d91a00624af84478d3c0792a18a1edab94da1a2c1d52bf7ba06d0e52610b857bf7e0b7ea7e03294fdeaa53f45662f01aa63e9d78fb9a774e79915a90cedcd
7
- data.tar.gz: b23ab6c783d701ebb95a57c032cf4370fad29247d5fe68e7a165ad9f647c13221b765242f8d50a84a280b7a272186d8408e9043e4121faa05a561a8169343518
6
+ metadata.gz: 56a373b126a03b850a46d5657aa40b17e137e8744db5a8227972619bbd5f5b0594263fbd2f38e33aea1f77a01a8b85521934069a1d4014dbde3060454d796904
7
+ data.tar.gz: 02533c6429845159e78dc63c2cc14ed58b0ed76ccf4e167c25a61ad1fb19333f673cab359db9e23f59bf33f75f58db40998eff9744e19dbbd18624369459167b
data/CHANGELOG.mkd CHANGED
@@ -1,3 +1,10 @@
1
+ # 0.0.8 (2013-12-07)
2
+
3
+ Feature
4
+ --------
5
+
6
+ * Add clear! for just emptying tubes
7
+
1
8
  # 0.0.7 (2013-12-07)
2
9
 
3
10
  Bugfixes
@@ -1,7 +1,7 @@
1
1
  module Beanstalk
2
2
  module Client
3
3
  module Rspec
4
- VERSION = '0.0.7'
4
+ VERSION = '0.0.8'
5
5
  end
6
6
  end
7
7
  end
@@ -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
@@ -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 {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beanstalk-client-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Ferlito