Skip to content

Instantly share code, notes, and snippets.

@eric
Created September 6, 2013 21:03
Show Gist options
  • Save eric/6470015 to your computer and use it in GitHub Desktop.
Save eric/6470015 to your computer and use it in GitHub Desktop.
describe :child_watcher_behavior do
describe :async_watch, :async => true do
it_should_behave_like "all success return values"
before do
@watcher = Zookeeper::Callbacks::WatcherCallback.new
@cb = Zookeeper::Callbacks::StringsCallback.new
@rv = zk.get_children(:path => path, :watcher => @watcher, :watcher_context => path, :callback => @cb, :callback_context => path)
wait_until { @cb.completed? }
@cb.should be_completed
end
it %[should fire the watcher when the node has been deleted] do
@watcher.should_not be_completed
zk.delete(:path => path)[:rc].should == Zookeeper::ZOK
wait_until { @watcher.completed? }
@watcher.should be_completed
@watcher.path.should == path
@watcher.context.should == path
@watcher.type.should == Zookeeper::ZOO_DELETED_EVENT
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment