zk 1.9.3 → 1.10.0

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.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/build.yml +55 -0
  3. data/.gitignore +1 -0
  4. data/Gemfile +18 -8
  5. data/README.markdown +9 -9
  6. data/RELEASES.markdown +28 -1
  7. data/lib/zk/client/base.rb +15 -0
  8. data/lib/zk/client/threaded.rb +3 -3
  9. data/lib/zk/client.rb +1 -1
  10. data/lib/zk/election.rb +1 -1
  11. data/lib/zk/event_handler.rb +16 -8
  12. data/lib/zk/event_handler_subscription/base.rb +1 -1
  13. data/lib/zk/fork_hook.rb +9 -4
  14. data/lib/zk/locker/locker_base.rb +14 -2
  15. data/lib/zk/locker/semaphore.rb +1 -3
  16. data/lib/zk/logger.rb +34 -0
  17. data/lib/zk/node_deletion_watcher.rb +4 -5
  18. data/lib/zk/pool.rb +12 -12
  19. data/lib/zk/subscription.rb +1 -1
  20. data/lib/zk/threaded_callback.rb +1 -1
  21. data/lib/zk/threadpool.rb +1 -1
  22. data/lib/zk/version.rb +1 -1
  23. data/lib/zk.rb +1 -5
  24. data/spec/event_catcher_spec.rb +1 -1
  25. data/spec/logging_progress_bar_formatter.rb +1 -1
  26. data/spec/message_queue_spec.rb +6 -6
  27. data/spec/shared/client_examples.rb +81 -81
  28. data/spec/shared/locker_examples.rb +13 -13
  29. data/spec/spec_helper.rb +12 -13
  30. data/spec/support/bogus_mongoid.rb +1 -1
  31. data/spec/support/client_forker.rb +1 -1
  32. data/spec/support/event_catcher.rb +1 -1
  33. data/spec/support/logging.rb +15 -47
  34. data/spec/zk/00_forked_client_integration_spec.rb +3 -3
  35. data/spec/zk/client/locking_and_session_death_spec.rb +2 -2
  36. data/spec/zk/client_spec.rb +19 -19
  37. data/spec/zk/election_spec.rb +44 -44
  38. data/spec/zk/extensions_spec.rb +2 -2
  39. data/spec/zk/locker/exclusive_locker_spec.rb +41 -41
  40. data/spec/zk/locker/locker_basic_spec.rb +55 -33
  41. data/spec/zk/locker/semaphore_spec.rb +39 -32
  42. data/spec/zk/locker/shared_exclusive_integration_spec.rb +37 -37
  43. data/spec/zk/locker/shared_locker_spec.rb +43 -43
  44. data/spec/zk/locker_spec.rb +2 -2
  45. data/spec/zk/module_spec.rb +25 -25
  46. data/spec/zk/mongoid_spec.rb +47 -47
  47. data/spec/zk/node_deletion_watcher_spec.rb +39 -31
  48. data/spec/zk/pool_spec.rb +56 -65
  49. data/spec/zk/threaded_callback_spec.rb +10 -10
  50. data/spec/zk/threadpool_spec.rb +25 -25
  51. data/spec/zk/watch_spec.rb +67 -79
  52. data/spec/zk/zookeeper_spec.rb +36 -30
  53. data/zk.gemspec +1 -2
  54. metadata +26 -47
  55. data/.travis.yml +0 -25
  56. data/lib/zk/logging.rb +0 -36
@@ -8,12 +8,12 @@ shared_examples_for :shared_exclusive_integration do
8
8
 
9
9
  describe 'shared lock acquired first' do
10
10
  it %[should block exclusive locks from acquiring until released] do
11
- @sh_lock.lock.should be_true
12
- @ex_lock.lock.should be_false
11
+ expect(@sh_lock.lock).to be(true)
12
+ expect(@ex_lock.lock).to be(false)
13
13
 
14
14
  mutex = Monitor.new
15
15
  cond = mutex.new_cond
16
-
16
+
17
17
  th = Thread.new do
18
18
  logger.debug { "@ex_lock trying to acquire acquire lock" }
19
19
  @ex_lock.with_lock do
@@ -28,29 +28,29 @@ shared_examples_for :shared_exclusive_integration do
28
28
 
29
29
  mutex.synchronize do
30
30
  logger.debug { "unlocking the shared lock" }
31
- @sh_lock.unlock.should be_true
31
+ expect(@sh_lock.unlock).to be(true)
32
32
  cond.wait_until { th[:got_lock] } # make sure they actually received the lock (avoid race)
33
- th[:got_lock].should be_true
33
+ expect(th[:got_lock]).to be(true)
34
34
  logger.debug { "ok, they got the lock" }
35
35
  end
36
36
 
37
- th.join(5).should == th
37
+ expect(th.join(5)).to eq(th)
38
38
 
39
39
  logger.debug { "thread joined, exclusive lock should be releasd" }
40
40
 
41
- @ex_lock.should_not be_locked
41
+ expect(@ex_lock).not_to be_locked
42
42
  end
43
43
  end
44
44
 
45
45
  describe 'multiple shared locks acquired first' do
46
46
  before do
47
- zk3.should_not be_nil
48
- @sh_lock2 = ZK::Locker.shared_locker(zk3, path)
47
+ expect(zk3).not_to be_nil
48
+ @sh_lock2 = ZK::Locker.shared_locker(zk3, path)
49
49
  end
50
50
  it %[should not aquire a lock when highest-numbered released but others remain] do
51
- @sh_lock.lock.should be_true
52
- @sh_lock2.lock.should be_true
53
- @ex_lock.lock.should be_false
51
+ expect(@sh_lock.lock).to be(true)
52
+ expect(@sh_lock2.lock).to be(true)
53
+ expect(@ex_lock.lock).to be(false)
54
54
 
55
55
  mutex = Monitor.new
56
56
  cond = mutex.new_cond
@@ -75,28 +75,28 @@ shared_examples_for :shared_exclusive_integration do
75
75
  mutex.synchronize do
76
76
  @ex_lock.wait_until_blocked(1)
77
77
  logger.debug { "unlocking the highest shared lock" }
78
- @sh_lock2.unlock.should be_true
78
+ expect(@sh_lock2.unlock).to be(true)
79
79
  cond.wait_until { (!th[:got_lock].nil?) } # make sure they actually received the lock (avoid race)
80
- th[:got_lock].should be_false
80
+ expect(th[:got_lock]).to be(false)
81
81
  logger.debug { "they didn't get the lock." }
82
82
  end
83
83
 
84
- th.join(5).should == th
84
+ expect(th.join(5)).to eq(th)
85
85
 
86
86
  logger.debug { "thread joined, exclusive lock should be releasd" }
87
- @sh_lock.unlock.should be_true
88
- @ex_lock.should_not be_locked
87
+ expect(@sh_lock.unlock).to be(true)
88
+ expect(@ex_lock).not_to be_locked
89
89
  end
90
90
  end
91
91
 
92
92
  describe 'exclusive lock acquired first' do
93
93
  it %[should block shared lock from acquiring until released] do
94
- @ex_lock.lock.should be_true
95
- @sh_lock.lock.should be_false
94
+ expect(@ex_lock.lock).to be(true)
95
+ expect(@sh_lock.lock).to be(false)
96
96
 
97
97
  mutex = Monitor.new
98
98
  cond = mutex.new_cond
99
-
99
+
100
100
  th = Thread.new do
101
101
  logger.debug { "@ex_lock trying to acquire acquire lock" }
102
102
  @sh_lock.with_lock do
@@ -111,31 +111,31 @@ shared_examples_for :shared_exclusive_integration do
111
111
 
112
112
  mutex.synchronize do
113
113
  logger.debug { "unlocking the shared lock" }
114
- @ex_lock.unlock.should be_true
114
+ expect(@ex_lock.unlock).to be(true)
115
115
  cond.wait_until { th[:got_lock] } # make sure they actually received the lock (avoid race)
116
- th[:got_lock].should be_true
116
+ expect(th[:got_lock]).to be(true)
117
117
  logger.debug { "ok, they got the lock" }
118
118
  end
119
119
 
120
- th.join(5).should == th
120
+ expect(th.join(5)).to eq(th)
121
121
 
122
122
  logger.debug { "thread joined, exclusive lock should be releasd" }
123
123
 
124
- @sh_lock.should_not be_locked
124
+ expect(@sh_lock).not_to be_locked
125
125
  end
126
126
  end
127
127
 
128
128
  describe 'shared-exclusive-shared' do
129
129
  before do
130
- zk3.should_not be_nil
131
- @sh_lock2 = ZK::Locker.shared_locker(zk3, path)
130
+ expect(zk3).not_to be_nil
131
+ @sh_lock2 = ZK::Locker.shared_locker(zk3, path)
132
132
  end
133
133
 
134
134
  it %[should act something like a queue] do
135
135
  @array = []
136
136
 
137
- @sh_lock.lock.should be_true
138
- @sh_lock.should be_locked
137
+ expect(@sh_lock.lock).to be(true)
138
+ expect(@sh_lock).to be_locked
139
139
 
140
140
  ex_th = Thread.new do
141
141
  begin
@@ -150,15 +150,15 @@ shared_examples_for :shared_exclusive_integration do
150
150
  logger.debug { "about to wait for @ex_lock to be blocked" }
151
151
 
152
152
  @ex_lock.wait_until_blocked(5)
153
- @ex_lock.should be_waiting
153
+ expect(@ex_lock).to be_waiting
154
154
 
155
155
  logger.debug { "@ex_lock is waiting" }
156
156
 
157
- @ex_lock.should_not be_locked
157
+ expect(@ex_lock).not_to be_locked
158
158
 
159
159
  # this is the important one, does the second shared lock get blocked by
160
160
  # the exclusive lock
161
- @sh_lock2.lock.should_not be_true
161
+ expect(@sh_lock2.lock).not_to be(true)
162
162
 
163
163
  sh2_th = Thread.new do
164
164
  begin
@@ -173,19 +173,19 @@ shared_examples_for :shared_exclusive_integration do
173
173
  logger.debug { "about to wait for @sh_lock2 to be blocked" }
174
174
 
175
175
  @sh_lock2.wait_until_blocked(5)
176
- @sh_lock2.should be_waiting
176
+ expect(@sh_lock2).to be_waiting
177
177
 
178
178
  logger.debug { "@sh_lock2 is waiting" }
179
179
 
180
180
  # ok, now unlock the first in the chain
181
181
  @sh_lock.assert!
182
- @sh_lock.unlock.should be_true
182
+ expect(@sh_lock.unlock).to be(true)
183
183
 
184
- ex_th.join(5).should == ex_th
185
- sh2_th.join(5).should == sh2_th
184
+ expect(ex_th.join(5)).to eq(ex_th)
185
+ expect(sh2_th.join(5)).to eq(sh2_th)
186
186
 
187
- @array.length.should == 2
188
- @array.should == [:ex_lock, :sh_lock2]
187
+ expect(@array.length).to eq(2)
188
+ expect(@array).to eq([:ex_lock, :sh_lock2])
189
189
  end
190
190
  end
191
191
  end # shared_exclusive_integration
@@ -9,17 +9,17 @@ shared_examples_for 'ZK::Locker::SharedLocker' do
9
9
 
10
10
  it %[should raise LockAssertionFailedError if there is an exclusive lock with a number lower than ours] do
11
11
  # this should *really* never happen
12
- locker.lock.should be_true
12
+ expect(locker.lock).to be(true)
13
13
  shl_path = locker.lock_path
14
14
 
15
- locker2.lock.should be_true
15
+ expect(locker2.lock).to be(true)
16
16
 
17
- locker.unlock.should be_true
18
- locker.should_not be_locked
17
+ expect(locker.unlock).to be(true)
18
+ expect(locker).not_to be_locked
19
19
 
20
- zk.exists?(shl_path).should be_false
20
+ expect(zk.exists?(shl_path)).to be(false)
21
21
 
22
- locker2.lock_path.should_not == shl_path
22
+ expect(locker2.lock_path).not_to eq(shl_path)
23
23
 
24
24
  # convert the first shared lock path into a exclusive one
25
25
 
@@ -27,7 +27,7 @@ shared_examples_for 'ZK::Locker::SharedLocker' do
27
27
 
28
28
  zk.create(exl_path, :ephemeral => true)
29
29
 
30
- lambda { locker2.assert! }.should raise_error(ZK::Exceptions::LockAssertionFailedError)
30
+ expect { locker2.assert! }.to raise_error(ZK::Exceptions::LockAssertionFailedError)
31
31
  end
32
32
  end
33
33
 
@@ -35,18 +35,18 @@ shared_examples_for 'ZK::Locker::SharedLocker' do
35
35
  describe %[with default options] do
36
36
  it %[should work if the lock root doesn't exist] do
37
37
  zk.rm_rf(ZK::Locker.default_root_lock_node)
38
- locker.should be_acquirable
38
+ expect(locker).to be_acquirable
39
39
  end
40
40
 
41
41
  it %[should check local state of lockedness] do
42
- locker.lock.should be_true
43
- locker.should be_acquirable
42
+ expect(locker.lock).to be(true)
43
+ expect(locker).to be_acquirable
44
44
  end
45
45
 
46
46
  it %[should check if any participants would prevent us from acquiring the lock] do
47
47
  ex_lock = ZK::Locker.exclusive_locker(zk, path)
48
- ex_lock.lock.should be_true
49
- locker.should_not be_acquirable
48
+ expect(ex_lock.lock).to be(true)
49
+ expect(locker).not_to be_acquirable
50
50
  end
51
51
  end
52
52
  end
@@ -59,13 +59,13 @@ shared_examples_for 'ZK::Locker::SharedLocker' do
59
59
  end
60
60
 
61
61
  it %[should acquire the first lock] do
62
- @rval.should be_true
63
- locker.should be_locked
62
+ expect(@rval).to be(true)
63
+ expect(locker).to be_locked
64
64
  end
65
65
 
66
66
  it %[should acquire the second lock] do
67
- @rval2.should be_true
68
- locker2.should be_locked
67
+ expect(@rval2).to be(true)
68
+ expect(locker2).to be_locked
69
69
  end
70
70
  end
71
71
 
@@ -77,11 +77,11 @@ shared_examples_for 'ZK::Locker::SharedLocker' do
77
77
  end
78
78
 
79
79
  it %[should return false] do
80
- @rval.should be_false
80
+ expect(@rval).to be(false)
81
81
  end
82
82
 
83
83
  it %[should not be locked] do
84
- locker.should_not be_locked
84
+ expect(locker).not_to be_locked
85
85
  end
86
86
  end
87
87
 
@@ -96,7 +96,7 @@ shared_examples_for 'ZK::Locker::SharedLocker' do
96
96
  it %[should acquire the lock after the write lock is released old-style] do
97
97
  ary = []
98
98
 
99
- locker.lock.should be_false
99
+ expect(locker.lock).to be(false)
100
100
 
101
101
  th = Thread.new do
102
102
  locker.lock(true)
@@ -104,24 +104,24 @@ shared_examples_for 'ZK::Locker::SharedLocker' do
104
104
  end
105
105
 
106
106
  locker.wait_until_blocked(5)
107
- locker.should be_waiting
108
- locker.should_not be_locked
109
- ary.should be_empty
107
+ expect(locker).to be_waiting
108
+ expect(locker).not_to be_locked
109
+ expect(ary).to be_empty
110
110
 
111
111
  zk.delete(@write_lock_path)
112
112
 
113
- th.join(2).should == th
113
+ expect(th.join(2)).to eq(th)
114
114
 
115
- ary.should_not be_empty
116
- ary.length.should == 1
115
+ expect(ary).not_to be_empty
116
+ expect(ary.length).to eq(1)
117
117
 
118
- locker.should be_locked
118
+ expect(locker).to be_locked
119
119
  end
120
120
 
121
121
  it %[should acquire the lock after the write lock is released new-style] do
122
122
  ary = []
123
123
 
124
- locker.lock.should be_false
124
+ expect(locker.lock).to be(false)
125
125
 
126
126
  th = Thread.new do
127
127
  locker.lock(:wait => true)
@@ -129,18 +129,18 @@ shared_examples_for 'ZK::Locker::SharedLocker' do
129
129
  end
130
130
 
131
131
  locker.wait_until_blocked(5)
132
- locker.should be_waiting
133
- locker.should_not be_locked
134
- ary.should be_empty
132
+ expect(locker).to be_waiting
133
+ expect(locker).not_to be_locked
134
+ expect(ary).to be_empty
135
135
 
136
136
  zk.delete(@write_lock_path)
137
137
 
138
- th.join(2).should == th
138
+ expect(th.join(2)).to eq(th)
139
139
 
140
- ary.should_not be_empty
141
- ary.length.should == 1
140
+ expect(ary).not_to be_empty
141
+ expect(ary.length).to eq(1)
142
142
 
143
- locker.should be_locked
143
+ expect(locker).to be_locked
144
144
  end
145
145
  end
146
146
 
@@ -150,9 +150,9 @@ shared_examples_for 'ZK::Locker::SharedLocker' do
150
150
 
151
151
  write_lock_dir = File.dirname(@write_lock_path)
152
152
 
153
- zk.children(write_lock_dir).length.should == 1
153
+ expect(zk.children(write_lock_dir).length).to eq(1)
154
154
 
155
- locker.lock.should be_false
155
+ expect(locker.lock).to be(false)
156
156
 
157
157
  th = Thread.new do
158
158
  begin
@@ -164,16 +164,16 @@ shared_examples_for 'ZK::Locker::SharedLocker' do
164
164
  end
165
165
 
166
166
  locker.wait_until_blocked(5)
167
- locker.should be_waiting
168
- locker.should_not be_locked
169
- ary.should be_empty
167
+ expect(locker).to be_waiting
168
+ expect(locker).not_to be_locked
169
+ expect(ary).to be_empty
170
170
 
171
- th.join(2).should == th
171
+ expect(th.join(2)).to eq(th)
172
172
 
173
- zk.children(write_lock_dir).length.should == 1
173
+ expect(zk.children(write_lock_dir).length).to eq(1)
174
174
 
175
- ary.should be_empty
176
- @exc.should be_kind_of(ZK::Exceptions::LockWaitTimeoutError)
175
+ expect(ary).to be_empty
176
+ expect(@exc).to be_kind_of(ZK::Exceptions::LockWaitTimeoutError)
177
177
  end
178
178
 
179
179
  end
@@ -14,9 +14,9 @@ describe ZK::Locker do
14
14
 
15
15
  ZK::Locker.cleanup(@zk)
16
16
 
17
- lambda { locker.assert! }.should_not raise_error
17
+ expect { locker.assert! }.not_to raise_error
18
18
 
19
- bogus_lock_dir_names.each { |n| @zk.stat("#{ZK::Locker.default_root_lock_node}/#{n}").should_not exist }
19
+ bogus_lock_dir_names.each { |n| expect(@zk.stat("#{ZK::Locker.default_root_lock_node}/#{n}")).not_to exist }
20
20
 
21
21
  end
22
22
  end
@@ -21,7 +21,7 @@ describe ZK do
21
21
 
22
22
  describe %[with a chrooted connection string and a :chroot => '/path'] do
23
23
  it %[should raise an ArgumentError] do
24
- lambda { @zk = ZK.new("#{connection_host}/zktest", :chroot => '/zktest') }.should raise_error(ArgumentError)
24
+ expect { @zk = ZK.new("#{connection_host}/zktest", :chroot => '/zktest') }.to raise_error(ArgumentError)
25
25
  end
26
26
  end
27
27
 
@@ -29,7 +29,7 @@ describe ZK do
29
29
  before { @zk = ZK.new }
30
30
 
31
31
  it %[should create a default connection] do
32
- @zk.should be_connected
32
+ expect(@zk).to be_connected
33
33
  end
34
34
  end
35
35
 
@@ -54,10 +54,10 @@ describe ZK do
54
54
  before { @zk = ZK.new(:chroot => chroot_path) }
55
55
 
56
56
  it %[should use the default connection string, create the chroot and return the connection] do
57
- @zk.exists?('/').should be_true
57
+ expect(@zk.exists?('/')).to be(true)
58
58
  @zk.create('/blah', 'data')
59
59
 
60
- @unchroot.get("#{chroot_path}/blah").first.should == 'data'
60
+ expect(@unchroot.get("#{chroot_path}/blah").first).to eq('data')
61
61
  end
62
62
  end
63
63
 
@@ -69,10 +69,10 @@ describe ZK do
69
69
  end
70
70
 
71
71
  it %[should create the chroot path and then return the connection] do
72
- @zk.exists?('/').should be_true
72
+ expect(@zk.exists?('/')).to be(true)
73
73
  @zk.create('/blah', 'data')
74
74
 
75
- @unchroot.get("#{chroot_path}/blah").first.should == 'data'
75
+ expect(@unchroot.get("#{chroot_path}/blah").first).to eq('data')
76
76
  end
77
77
  end
78
78
 
@@ -82,26 +82,26 @@ describe ZK do
82
82
  end
83
83
 
84
84
  it %[should create the chroot path and then return the connection] do
85
- @zk.exists?('/').should be_true
85
+ expect(@zk.exists?('/')).to be(true)
86
86
  @zk.create('/blah', 'data')
87
87
 
88
- @unchroot.get("#{chroot_path}/blah").first.should == 'data'
88
+ expect(@unchroot.get("#{chroot_path}/blah").first).to eq('data')
89
89
  end
90
90
  end
91
91
 
92
92
  describe %[and :chroot => :check] do
93
93
  it %[should barf with a ChrootPathDoesNotExistError] do
94
- lambda do
94
+ expect do
95
95
  # assign in case of a bug, that way this connection will get torn down
96
96
  @zk = ZK.new("#{connection_host}#{chroot_path}", :chroot => :check)
97
- end.should raise_error(ZK::Exceptions::ChrootPathDoesNotExistError)
97
+ end.to raise_error(ZK::Exceptions::ChrootPathDoesNotExistError)
98
98
  end
99
99
  end
100
100
 
101
101
  describe %[and :chroot => :do_nothing] do
102
102
  it %[should return a connection in a weird state] do
103
103
  @zk = ZK.new("#{connection_host}#{chroot_path}", :chroot => :do_nothing)
104
- lambda { @zk.get('/') }.should raise_error(ZK::Exceptions::NoNode)
104
+ expect { @zk.get('/') }.to raise_error(ZK::Exceptions::NoNode)
105
105
  end
106
106
  end
107
107
 
@@ -109,10 +109,10 @@ describe ZK do
109
109
  before { @zk = ZK.new(connection_host, :chroot => chroot_path) }
110
110
 
111
111
  it %[should create the chroot path and then return the connection] do
112
- @zk.exists?('/').should be_true
112
+ expect(@zk.exists?('/')).to be(true)
113
113
  @zk.create('/blah', 'data')
114
114
 
115
- @unchroot.get("#{chroot_path}/blah").first.should == 'data'
115
+ expect(@unchroot.get("#{chroot_path}/blah").first).to eq('data')
116
116
  end
117
117
  end
118
118
  end # as a connection string
@@ -125,10 +125,10 @@ describe ZK do
125
125
  before { @zk = ZK.new(:chroot => chroot_path) }
126
126
 
127
127
  it %[should use the default connection string and totally work] do
128
- @zk.exists?('/').should be_true
128
+ expect(@zk.exists?('/')).to be(true)
129
129
  @zk.create('/blah', 'data')
130
130
 
131
- @unchroot.get("#{chroot_path}/blah").first.should == 'data'
131
+ expect(@unchroot.get("#{chroot_path}/blah").first).to eq('data')
132
132
  end
133
133
  end
134
134
 
@@ -139,10 +139,10 @@ describe ZK do
139
139
  end
140
140
 
141
141
  it %[should totally work] do
142
- @zk.exists?('/').should be_true
142
+ expect(@zk.exists?('/')).to be(true)
143
143
  @zk.create('/blah', 'data')
144
144
 
145
- @unchroot.get("#{chroot_path}/blah").first.should == 'data'
145
+ expect(@unchroot.get("#{chroot_path}/blah").first).to eq('data')
146
146
  end
147
147
  end
148
148
 
@@ -152,26 +152,26 @@ describe ZK do
152
152
  end
153
153
 
154
154
  it %[should totally work] do
155
- @zk.exists?('/').should be_true
155
+ expect(@zk.exists?('/')).to be(true)
156
156
  @zk.create('/blah', 'data')
157
157
 
158
- @unchroot.get("#{chroot_path}/blah").first.should == 'data'
158
+ expect(@unchroot.get("#{chroot_path}/blah").first).to eq('data')
159
159
  end
160
160
  end
161
161
 
162
162
  describe %[and :chroot => :check] do
163
163
  it %[should totally work] do
164
- lambda do
164
+ expect do
165
165
  # assign in case of a bug, that way this connection will get torn down
166
166
  @zk = ZK.new("#{connection_host}#{chroot_path}", :chroot => :check)
167
- end.should_not raise_error
167
+ end.not_to raise_error
168
168
  end
169
169
  end
170
170
 
171
171
  describe %[and :chroot => :do_nothing] do
172
172
  it %[should totally work] do
173
173
  @zk = ZK.new("#{connection_host}#{chroot_path}", :chroot => :do_nothing)
174
- lambda { @zk.get('/') }.should_not raise_error
174
+ expect { @zk.get('/') }.not_to raise_error
175
175
  end
176
176
  end
177
177
 
@@ -179,15 +179,15 @@ describe ZK do
179
179
  before { @zk = ZK.new(connection_host, :chroot => chroot_path) }
180
180
 
181
181
  it %[should totally work] do
182
- @zk.exists?('/').should be_true
182
+ expect(@zk.exists?('/')).to be(true)
183
183
  @zk.create('/blah', 'data')
184
184
 
185
- @unchroot.get("#{chroot_path}/blah").first.should == 'data'
185
+ expect(@unchroot.get("#{chroot_path}/blah").first).to eq('data')
186
186
  end
187
187
  end
188
188
  end # as a connection string
189
189
  end # that exists
190
- end # with a chroot
190
+ end # with a chroot
191
191
  end # :new
192
192
  end # ZK
193
193