lib/beanstalk-client-rspec.rb in beanstalk-client-rspec-0.0.6 vs lib/beanstalk-client-rspec.rb in beanstalk-client-rspec-0.0.7
- old
+ new
@@ -4,18 +4,28 @@
module Beanstalk
class MockConnection < Beanstalk::Connection
def initialize(addr, default_tube=nil)
super
+ @default_tube = default_tube
+ reset!
+ end
+
+ # Tests use this to rest stuff
+ def reset!
@id_mutex = Mutex.new
@tube_mutex = Mutex.new
@tubes = {}
@id = 0
- end
- # Tests use this to rest stuff
- def reset!
- initialize(nil, @default_tube)
+ # Super reset
+ @mutex = Mutex.new
+ @tube_mutex = Mutex.new
+ @waiting = false
+ @last_used = 'default'
+ @watch_list = [@last_used]
+ self.use(@default_tube) if @default_tube
+ self.watch(@default_tube) if @default_tube
end
def connect
# We don't want to actually connect to anything
end