lib/beanstalk-client-rspec.rb in beanstalk-client-rspec-0.0.7 vs lib/beanstalk-client-rspec.rb in beanstalk-client-rspec-0.0.8
- old
+ new
@@ -25,10 +25,23 @@
@watch_list = [@last_used]
self.use(@default_tube) if @default_tube
self.watch(@default_tube) if @default_tube
end
+ # Tests use this to rest stuff
+ def clear!
+ @id_mutex = Mutex.new
+ @tube_mutex = Mutex.new
+ @tubes = {}
+ @id = 0
+
+ # Super reset
+ @mutex = Mutex.new
+ @tube_mutex = Mutex.new
+ @waiting = false
+ end
+
def connect
# We don't want to actually connect to anything
end
# TODO Put on to reservation queue and deal with bury etc
@@ -137,9 +150,15 @@
end
def reset!
@connections.values.each do |c|
c.reset!
+ end
+ end
+
+ def clear!
+ @connections.values.each do |c|
+ c.clear!
end
end
end
end