spec/support/event_catcher.rb in zk-1.1.1 vs spec/support/event_catcher.rb in zk-1.2.0
- old
+ new
@@ -4,11 +4,11 @@
def_delegators :@mutex, :synchronize
MEMBERS = [:created, :changed, :deleted, :child, :all]
- attr_reader :events
+ attr_reader :events, :mutex
def initialize(*args)
@mutex = Monitor.new
@conds = {}
@events = {}
@@ -62,18 +62,18 @@
cond(:#{name})
end
# waits for an event group to not be empty (up to timeout sec)
def wait_for_#{name}(timeout=5)
- cond(:#{name}).wait(timeout)
+ wait_for(:#{name}, timeout)
end
- def wait_while_#{name}
- cond(:#{name}).wait_while { yield __send__(:#{name}) }
+ def wait_while_#{name}(&blk)
+ wait_while(:#{name}, &blk)
end
- def wait_until_#{name}
- cond(:#{name}).wait_until { yield __send__(:#{name}) }
+ def wait_until_#{name}(&blk)
+ wait_until(:#{name}, &blk)
end
EOS
end
end