zookeeper 1.5.3 → 1.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,14 +10,6 @@ shared_examples_for "connection" do
10
10
  ensure_node(zk, path, data)
11
11
  end
12
12
 
13
- after :all do
14
- logger.warn "running shared examples after :all"
15
-
16
- with_open_zk(connection_string) do |z|
17
- rm_rf(z, path)
18
- end
19
- end
20
-
21
13
  # unfortunately, we can't test w/o exercising other parts of the driver, so
22
14
  # if "set" is broken, this test will fail as well (but whaddyagonnado?)
23
15
  describe :get do
@@ -29,12 +21,12 @@ shared_examples_for "connection" do
29
21
  end
30
22
 
31
23
  it %[should return the data] do
32
- @rv[:data].should == data
24
+ expect(@rv[:data]).to eq(data)
33
25
  end
34
26
 
35
27
  it %[should return a stat] do
36
- @rv[:stat].should_not be_nil
37
- @rv[:stat].should be_kind_of(Zookeeper::Stat)
28
+ expect(@rv[:stat]).not_to be_nil
29
+ expect(@rv[:stat]).to be_kind_of(Zookeeper::Stat)
38
30
  end
39
31
  end
40
32
 
@@ -45,23 +37,23 @@ shared_examples_for "connection" do
45
37
  @event = nil
46
38
  @watcher = Zookeeper::Callbacks::WatcherCallback.new
47
39
 
48
- @rv = zk.get(:path => path, :watcher => @watcher, :watcher_context => path)
40
+ @rv = zk.get(:path => path, :watcher => @watcher, :watcher_context => path)
49
41
  end
50
42
 
51
43
  it %[should return the data] do
52
- @rv[:data].should == data
44
+ expect(@rv[:data]).to eq(data)
53
45
  end
54
46
 
55
47
  it %[should set a watcher on the node] do
56
48
  # test the watcher by changing node data
57
- zk.set(:path => path, :data => 'blah')[:rc].should be_zero
49
+ expect(zk.set(:path => path, :data => 'blah')[:rc]).to be_zero
58
50
 
59
51
  wait_until(1.0) { @watcher.completed? }
60
52
 
61
- @watcher.path.should == path
62
- @watcher.context.should == path
63
- @watcher.should be_completed
64
- @watcher.type.should == Zookeeper::ZOO_CHANGED_EVENT
53
+ expect(@watcher.path).to eq(path)
54
+ expect(@watcher.context).to eq(path)
55
+ expect(@watcher).to be_completed
56
+ expect(@watcher.type).to eq(Zookeeper::ZOO_CHANGED_EVENT)
65
57
  end
66
58
  end
67
59
 
@@ -71,22 +63,22 @@ shared_examples_for "connection" do
71
63
 
72
64
  @rv = zk.get(:path => path, :callback => @cb, :callback_context => path)
73
65
  wait_until(1.0) { @cb.completed? }
74
- @cb.should be_completed
66
+ expect(@cb).to be_completed
75
67
  end
76
68
 
77
69
  it_should_behave_like "all success return values"
78
70
 
79
71
  it %[should have a return code of ZOK] do
80
- @cb.return_code.should == Zookeeper::ZOK
72
+ expect(@cb.return_code).to eq(Zookeeper::ZOK)
81
73
  end
82
74
 
83
75
  it %[should have the stat object in the callback] do
84
- @cb.stat.should_not be_nil
85
- @cb.stat.should be_kind_of(Zookeeper::Stat)
76
+ expect(@cb.stat).not_to be_nil
77
+ expect(@cb.stat).to be_kind_of(Zookeeper::Stat)
86
78
  end
87
79
 
88
80
  it %[should have the data] do
89
- @cb.data.should == data
81
+ expect(@cb.data).to eq(data)
90
82
  end
91
83
  end
92
84
 
@@ -100,38 +92,38 @@ shared_examples_for "connection" do
100
92
 
101
93
  @rv = zk.get(:path => path, :callback => @cb, :callback_context => path, :watcher => @watcher, :watcher_context => path)
102
94
  wait_until(1.0) { @cb.completed? }
103
- @cb.should be_completed
95
+ expect(@cb).to be_completed
104
96
  logger.debug { "-----------------> ASYNC GET REQUEST WITH WATCH COMPLETE <--------------------" }
105
97
  end
106
98
 
107
99
  it %[should have the stat object in the callback] do
108
- @cb.stat.should_not be_nil
109
- @cb.stat.should be_kind_of(Zookeeper::Stat)
100
+ expect(@cb.stat).not_to be_nil
101
+ expect(@cb.stat).to be_kind_of(Zookeeper::Stat)
110
102
  end
111
103
 
112
104
  it %[should have the data] do
113
- @cb.data.should == data
105
+ expect(@cb.data).to eq(data)
114
106
  end
115
107
 
116
108
  it %[should have a return code of ZOK] do
117
- @cb.return_code.should == Zookeeper::ZOK
109
+ expect(@cb.return_code).to eq(Zookeeper::ZOK)
118
110
  end
119
111
 
120
112
  it %[should set a watcher on the node] do
121
- zk.set(:path => path, :data => 'blah')[:rc].should be_zero
113
+ expect(zk.set(:path => path, :data => 'blah')[:rc]).to be_zero
122
114
 
123
115
  wait_until(2) { @watcher.completed? }
124
116
 
125
- @watcher.should be_completed
117
+ expect(@watcher).to be_completed
126
118
 
127
- @watcher.path.should == path
128
- @watcher.context.should == path
119
+ expect(@watcher.path).to eq(path)
120
+ expect(@watcher.context).to eq(path)
129
121
  end
130
122
  end
131
123
 
132
124
  describe 'bad arguments' do
133
125
  it %[should barf with a BadArguments error] do
134
- lambda { zk.get(:bad_arg => 'what!?') }.should raise_error(Zookeeper::Exceptions::BadArguments)
126
+ expect { zk.get(:bad_arg => 'what!?') }.to raise_error(Zookeeper::Exceptions::BadArguments)
135
127
  end
136
128
  end
137
129
  end # get
@@ -151,9 +143,9 @@ shared_examples_for "connection" do
151
143
  end
152
144
 
153
145
  it %[should return the new stat] do
154
- @rv[:stat].should_not be_nil
155
- @rv[:stat].should be_kind_of(Zookeeper::Stat)
156
- @rv[:stat].version.should > @stat.version
146
+ expect(@rv[:stat]).not_to be_nil
147
+ expect(@rv[:stat]).to be_kind_of(Zookeeper::Stat)
148
+ expect(@rv[:stat].version).to be > @stat.version
157
149
  end
158
150
  end
159
151
 
@@ -165,9 +157,9 @@ shared_examples_for "connection" do
165
157
  end
166
158
 
167
159
  it %[should return the new stat] do
168
- @rv[:stat].should_not be_nil
169
- @rv[:stat].should be_kind_of(Zookeeper::Stat)
170
- @rv[:stat].version.should > @stat.version
160
+ expect(@rv[:stat]).not_to be_nil
161
+ expect(@rv[:stat]).to be_kind_of(Zookeeper::Stat)
162
+ expect(@rv[:stat].version).to be > @stat.version
171
163
  end
172
164
  end
173
165
 
@@ -180,11 +172,11 @@ shared_examples_for "connection" do
180
172
  end
181
173
 
182
174
  it %[should have a return code of ZBADVERSION] do
183
- @rv[:rc].should == Zookeeper::ZBADVERSION
175
+ expect(@rv[:rc]).to eq(Zookeeper::ZBADVERSION)
184
176
  end
185
177
 
186
178
  it %[should return a stat with !exists] do
187
- @rv[:stat].exists.should be_false
179
+ expect(@rv[:stat].exists).to be_falsey
188
180
  end
189
181
  end
190
182
 
@@ -192,7 +184,7 @@ shared_examples_for "connection" do
192
184
  it %[should barf if the data size is too large], :input_size => true do
193
185
  large_data = '0' * (1024 ** 2)
194
186
 
195
- lambda { zk.set(:path => path, :data => large_data) }.should raise_error(Zookeeper::Exceptions::DataTooLargeException)
187
+ expect { zk.set(:path => path, :data => large_data) }.to raise_error(Zookeeper::Exceptions::DataTooLargeException)
196
188
  end
197
189
  end
198
190
  end # sync
@@ -209,16 +201,16 @@ shared_examples_for "connection" do
209
201
  @rv = zk.set(:path => path, :data => @new_data, :callback => @cb, :callback_context => path)
210
202
 
211
203
  wait_until(2) { @cb.completed? }
212
- @cb.should be_completed
204
+ expect(@cb).to be_completed
213
205
  end
214
206
 
215
207
  it %[should have the stat in the callback] do
216
- @cb.stat.should_not be_nil
217
- @cb.stat.version.should > @stat.version
208
+ expect(@cb.stat).not_to be_nil
209
+ expect(@cb.stat.version).to be > @stat.version
218
210
  end
219
211
 
220
212
  it %[should have a return code of ZOK] do
221
- @cb.return_code.should == Zookeeper::ZOK
213
+ expect(@cb.return_code).to eq(Zookeeper::ZOK)
222
214
  end
223
215
  end
224
216
 
@@ -229,16 +221,16 @@ shared_examples_for "connection" do
229
221
  @rv = zk.set(:path => path, :data => @new_data, :callback => @cb, :callback_context => path, :version => @stat.version)
230
222
 
231
223
  wait_until(2) { @cb.completed? }
232
- @cb.should be_completed
224
+ expect(@cb).to be_completed
233
225
  end
234
226
 
235
227
  it %[should have the stat in the callback] do
236
- @cb.stat.should_not be_nil
237
- @cb.stat.version.should > @stat.version
228
+ expect(@cb.stat).not_to be_nil
229
+ expect(@cb.stat.version).to be > @stat.version
238
230
  end
239
231
 
240
232
  it %[should have a return code of ZOK] do
241
- @cb.return_code.should == Zookeeper::ZOK
233
+ expect(@cb.return_code).to eq(Zookeeper::ZOK)
242
234
  end
243
235
  end
244
236
 
@@ -250,15 +242,15 @@ shared_examples_for "connection" do
250
242
  @rv = zk.set(:path => path, :data => @new_data, :callback => @cb, :callback_context => path, :version => 0)
251
243
 
252
244
  wait_until(2) { @cb.completed? }
253
- @cb.should be_completed
245
+ expect(@cb).to be_completed
254
246
  end
255
247
 
256
248
  it %[should have a return code of ZBADVERSION] do
257
- @cb.return_code.should == Zookeeper::ZBADVERSION
249
+ expect(@cb.return_code).to eq(Zookeeper::ZBADVERSION)
258
250
  end
259
251
 
260
252
  it %[should return a stat with !exists] do
261
- @cb.stat.exists.should be_false
253
+ expect(@cb.stat.exists).to be_falsey
262
254
  end
263
255
  end
264
256
 
@@ -266,7 +258,7 @@ shared_examples_for "connection" do
266
258
  it %[should barf if the data size is too large], :input_size => true do
267
259
  large_data = '0' * (1024 ** 2)
268
260
 
269
- lambda { zk.set(:path => path, :data => large_data, :callback => @cb, :callback_context => path) }.should raise_error(Zookeeper::Exceptions::DataTooLargeException)
261
+ expect { zk.set(:path => path, :data => large_data, :callback => @cb, :callback_context => path) }.to raise_error(Zookeeper::Exceptions::DataTooLargeException)
270
262
  end
271
263
  end
272
264
 
@@ -282,7 +274,7 @@ shared_examples_for "connection" do
282
274
  # gahhh, this shouldn't be like this.... :P
283
275
  rv = rv.respond_to?(:intValue) ? rv.intValue : rv
284
276
 
285
- rv.should == Zookeeper::ZOK
277
+ expect(rv).to eq(Zookeeper::ZOK)
286
278
  end
287
279
  end
288
280
 
@@ -309,17 +301,17 @@ shared_examples_for "connection" do
309
301
  end
310
302
 
311
303
  it %[should have an array of names of the children] do
312
- @rv[:children].should be_kind_of(Array)
313
- @rv[:children].length.should == 3
314
- @rv[:children].sort.should == @children.sort
304
+ expect(@rv[:children]).to be_kind_of(Array)
305
+ expect(@rv[:children].length).to eq(3)
306
+ expect(@rv[:children].sort).to eq(@children.sort)
315
307
  end
316
308
 
317
309
  # "Three shall be the number of the counting, and the number of the counting shall be 3"
318
310
 
319
311
  it %[should have a stat object whose num_children is 3] do
320
- @rv[:stat].should_not be_nil
321
- @rv[:stat].should be_kind_of(Zookeeper::Stat)
322
- @rv[:stat].num_children.should == 3
312
+ expect(@rv[:stat]).not_to be_nil
313
+ expect(@rv[:stat]).to be_kind_of(Zookeeper::Stat)
314
+ expect(@rv[:stat].num_children).to eq(3)
323
315
  end
324
316
  end
325
317
 
@@ -339,28 +331,28 @@ shared_examples_for "connection" do
339
331
  end
340
332
 
341
333
  it %[should have an array of names of the children] do
342
- @rv[:children].should be_kind_of(Array)
343
- @rv[:children].length.should == 3
344
- @rv[:children].sort.should == @children.sort
334
+ expect(@rv[:children]).to be_kind_of(Array)
335
+ expect(@rv[:children].length).to eq(3)
336
+ expect(@rv[:children].sort).to eq(@children.sort)
345
337
  end
346
338
 
347
339
  it %[should have a stat object whose num_children is 3] do
348
- @rv[:stat].should_not be_nil
349
- @rv[:stat].should be_kind_of(Zookeeper::Stat)
350
- @rv[:stat].num_children.should == 3
340
+ expect(@rv[:stat]).not_to be_nil
341
+ expect(@rv[:stat]).to be_kind_of(Zookeeper::Stat)
342
+ expect(@rv[:stat].num_children).to eq(3)
351
343
  end
352
344
 
353
345
  it %[should set a watcher for children on the node] do
354
- @watcher.should_not be_completed
346
+ expect(@watcher).not_to be_completed
355
347
 
356
- zk.create(:path => "#{path}/#{@addtl_child}", :data => '')[:rc].should == Zookeeper::ZOK
348
+ expect(zk.create(:path => "#{path}/#{@addtl_child}", :data => '')[:rc]).to eq(Zookeeper::ZOK)
357
349
 
358
350
  wait_until { @watcher.completed? }
359
- @watcher.should be_completed
351
+ expect(@watcher).to be_completed
360
352
 
361
- @watcher.path.should == path
362
- @watcher.context.should == path
363
- @watcher.type.should == Zookeeper::ZOO_CHILD_EVENT
353
+ expect(@watcher.path).to eq(path)
354
+ expect(@watcher.context).to eq(path)
355
+ expect(@watcher.type).to eq(Zookeeper::ZOO_CHILD_EVENT)
364
356
  end
365
357
  end
366
358
 
@@ -372,23 +364,23 @@ shared_examples_for "connection" do
372
364
  @rv = zk.get_children(:path => path, :callback => @cb, :callback_context => path)
373
365
 
374
366
  wait_until { @cb.completed? }
375
- @cb.should be_completed
367
+ expect(@cb).to be_completed
376
368
  end
377
369
 
378
370
  it %[should succeed] do
379
- @cb.return_code.should == Zookeeper::ZOK
371
+ expect(@cb.return_code).to eq(Zookeeper::ZOK)
380
372
  end
381
373
 
382
374
  it %[should return an array of children] do
383
- @cb.children.should be_kind_of(Array)
384
- @cb.children.length.should == 3
385
- @cb.children.sort.should == @children.sort
375
+ expect(@cb.children).to be_kind_of(Array)
376
+ expect(@cb.children.length).to eq(3)
377
+ expect(@cb.children.sort).to eq(@children.sort)
386
378
  end
387
379
 
388
380
  it %[should have a stat object whose num_children is 3] do
389
- @cb.stat.should_not be_nil
390
- @cb.stat.should be_kind_of(Zookeeper::Stat)
391
- @cb.stat.num_children.should == 3
381
+ expect(@cb.stat).not_to be_nil
382
+ expect(@cb.stat).to be_kind_of(Zookeeper::Stat)
383
+ expect(@cb.stat.num_children).to eq(3)
392
384
  end
393
385
  end
394
386
 
@@ -403,7 +395,7 @@ shared_examples_for "connection" do
403
395
 
404
396
  @rv = zk.get_children(:path => path, :watcher => @watcher, :watcher_context => path, :callback => @cb, :callback_context => path)
405
397
  wait_until { @cb.completed? }
406
- @cb.should be_completed
398
+ expect(@cb).to be_completed
407
399
  end
408
400
 
409
401
  after do
@@ -411,32 +403,32 @@ shared_examples_for "connection" do
411
403
  end
412
404
 
413
405
  it %[should succeed] do
414
- @cb.return_code.should == Zookeeper::ZOK
406
+ expect(@cb.return_code).to eq(Zookeeper::ZOK)
415
407
  end
416
408
 
417
409
  it %[should return an array of children] do
418
- @cb.children.should be_kind_of(Array)
419
- @cb.children.length.should == 3
420
- @cb.children.sort.should == @children.sort
410
+ expect(@cb.children).to be_kind_of(Array)
411
+ expect(@cb.children.length).to eq(3)
412
+ expect(@cb.children.sort).to eq(@children.sort)
421
413
  end
422
414
 
423
415
  it %[should have a stat object whose num_children is 3] do
424
- @cb.stat.should_not be_nil
425
- @cb.stat.should be_kind_of(Zookeeper::Stat)
426
- @cb.stat.num_children.should == 3
416
+ expect(@cb.stat).not_to be_nil
417
+ expect(@cb.stat).to be_kind_of(Zookeeper::Stat)
418
+ expect(@cb.stat.num_children).to eq(3)
427
419
  end
428
420
 
429
421
  it %[should set a watcher for children on the node] do
430
- @watcher.should_not be_completed
422
+ expect(@watcher).not_to be_completed
431
423
 
432
- zk.create(:path => "#{path}/#{@addtl_child}", :data => '')[:rc].should == Zookeeper::ZOK
424
+ expect(zk.create(:path => "#{path}/#{@addtl_child}", :data => '')[:rc]).to eq(Zookeeper::ZOK)
433
425
 
434
426
  wait_until { @watcher.completed? }
435
- @watcher.should be_completed
427
+ expect(@watcher).to be_completed
436
428
 
437
- @watcher.path.should == path
438
- @watcher.context.should == path
439
- @watcher.type.should == Zookeeper::ZOO_CHILD_EVENT
429
+ expect(@watcher.path).to eq(path)
430
+ expect(@watcher.context).to eq(path)
431
+ expect(@watcher.type).to eq(Zookeeper::ZOO_CHILD_EVENT)
440
432
  end
441
433
  end
442
434
  end
@@ -451,20 +443,20 @@ shared_examples_for "connection" do
451
443
 
452
444
  @rv = zk.get_children(:path => path, :watcher => @watcher, :watcher_context => path, :callback => @cb, :callback_context => path)
453
445
  wait_until { @cb.completed? }
454
- @cb.should be_completed
446
+ expect(@cb).to be_completed
455
447
  end
456
448
 
457
449
  it %[should fire the watcher when the node has been deleted] do
458
- @watcher.should_not be_completed
450
+ expect(@watcher).not_to be_completed
459
451
 
460
- zk.delete(:path => path)[:rc].should == Zookeeper::ZOK
452
+ expect(zk.delete(:path => path)[:rc]).to eq(Zookeeper::ZOK)
461
453
 
462
454
  wait_until { @watcher.completed? }
463
- @watcher.should be_completed
455
+ expect(@watcher).to be_completed
464
456
 
465
- @watcher.path.should == path
466
- @watcher.context.should == path
467
- @watcher.type.should == Zookeeper::ZOO_DELETED_EVENT
457
+ expect(@watcher.path).to eq(path)
458
+ expect(@watcher.context).to eq(path)
459
+ expect(@watcher.type).to eq(Zookeeper::ZOO_DELETED_EVENT)
468
460
  end
469
461
  end
470
462
  end
@@ -481,7 +473,7 @@ shared_examples_for "connection" do
481
473
  end
482
474
 
483
475
  it %[should have a stat object] do
484
- @rv[:stat].should be_kind_of(Zookeeper::Stat)
476
+ expect(@rv[:stat]).to be_kind_of(Zookeeper::Stat)
485
477
  end
486
478
  end
487
479
 
@@ -495,20 +487,20 @@ shared_examples_for "connection" do
495
487
  end
496
488
 
497
489
  it %[should have a stat object] do
498
- @rv[:stat].should be_kind_of(Zookeeper::Stat)
490
+ expect(@rv[:stat]).to be_kind_of(Zookeeper::Stat)
499
491
  end
500
492
 
501
493
  it %[should set a watcher for data changes on the node] do
502
- @watcher.should_not be_completed
494
+ expect(@watcher).not_to be_completed
503
495
 
504
- zk.set(:path => path, :data => 'skunk')[:rc].should == Zookeeper::ZOK
496
+ expect(zk.set(:path => path, :data => 'skunk')[:rc]).to eq(Zookeeper::ZOK)
505
497
 
506
498
  wait_until { @watcher.completed? }
507
- @watcher.should be_completed
499
+ expect(@watcher).to be_completed
508
500
 
509
- @watcher.path.should == path
510
- @watcher.context.should == path
511
- @watcher.type.should == Zookeeper::ZOO_CHANGED_EVENT
501
+ expect(@watcher.path).to eq(path)
502
+ expect(@watcher.context).to eq(path)
503
+ expect(@watcher.type).to eq(Zookeeper::ZOO_CHANGED_EVENT)
512
504
  end
513
505
  end
514
506
 
@@ -520,15 +512,15 @@ shared_examples_for "connection" do
520
512
  @rv = zk.stat(:path => path, :callback => @cb, :callback_context => path)
521
513
 
522
514
  wait_until { @cb.completed? }
523
- @cb.should be_completed
515
+ expect(@cb).to be_completed
524
516
  end
525
517
 
526
518
  it %[should succeed] do
527
- @cb.return_code.should == Zookeeper::ZOK
519
+ expect(@cb.return_code).to eq(Zookeeper::ZOK)
528
520
  end
529
521
 
530
522
  it %[should have a stat object] do
531
- @cb.stat.should be_kind_of(Zookeeper::Stat)
523
+ expect(@cb.stat).to be_kind_of(Zookeeper::Stat)
532
524
  end
533
525
  end
534
526
 
@@ -544,7 +536,7 @@ shared_examples_for "connection" do
544
536
  @rv = zk.stat(:path => path, :callback => @cb, :callback_context => path, :watcher => @watcher, :watcher_context => path)
545
537
 
546
538
  wait_until { @cb.completed? }
547
- @cb.should be_completed
539
+ expect(@cb).to be_completed
548
540
  end
549
541
 
550
542
  after do
@@ -552,24 +544,24 @@ shared_examples_for "connection" do
552
544
  end
553
545
 
554
546
  it %[should succeed] do
555
- @cb.return_code.should == Zookeeper::ZOK
547
+ expect(@cb.return_code).to eq(Zookeeper::ZOK)
556
548
  end
557
549
 
558
550
  it %[should have a stat object] do
559
- @cb.stat.should be_kind_of(Zookeeper::Stat)
551
+ expect(@cb.stat).to be_kind_of(Zookeeper::Stat)
560
552
  end
561
553
 
562
554
  it %[should set a watcher for data changes on the node] do
563
- @watcher.should_not be_completed
555
+ expect(@watcher).not_to be_completed
564
556
 
565
- zk.set(:path => path, :data => 'skunk')[:rc].should == Zookeeper::ZOK
557
+ expect(zk.set(:path => path, :data => 'skunk')[:rc]).to eq(Zookeeper::ZOK)
566
558
 
567
559
  wait_until { @watcher.completed? }
568
- @watcher.should be_completed
560
+ expect(@watcher).to be_completed
569
561
 
570
- @watcher.path.should == path
571
- @watcher.context.should == path
572
- @watcher.type.should == Zookeeper::ZOO_CHANGED_EVENT
562
+ expect(@watcher.path).to eq(path)
563
+ expect(@watcher.context).to eq(path)
564
+ expect(@watcher.type).to eq(Zookeeper::ZOO_CHANGED_EVENT)
573
565
  end
574
566
  end
575
567
  end # stat
@@ -585,7 +577,7 @@ shared_examples_for "connection" do
585
577
  it %[should barf if the data size is too large], :input_size => true do
586
578
  large_data = '0' * (1024 ** 2)
587
579
 
588
- lambda { zk.create(:path => path, :data => large_data) }.should raise_error(Zookeeper::Exceptions::DataTooLargeException)
580
+ expect { zk.create(:path => path, :data => large_data) }.to raise_error(Zookeeper::Exceptions::DataTooLargeException)
589
581
  end
590
582
  end
591
583
 
@@ -597,14 +589,14 @@ shared_examples_for "connection" do
597
589
  end
598
590
 
599
591
  it %[should return the path that was set] do
600
- @rv[:path].should == path
592
+ expect(@rv[:path]).to eq(path)
601
593
  end
602
594
 
603
595
  it %[should have created a permanent node] do
604
596
  st = zk.stat(:path => path)
605
- st[:rc].should == Zookeeper::ZOK
597
+ expect(st[:rc]).to eq(Zookeeper::ZOK)
606
598
 
607
- st[:stat].ephemeral_owner.should == 0
599
+ expect(st[:stat].ephemeral_owner).to eq(0)
608
600
  end
609
601
  end
610
602
 
@@ -616,14 +608,14 @@ shared_examples_for "connection" do
616
608
  end
617
609
 
618
610
  it %[should return the path that was set] do
619
- @rv[:path].should == path
611
+ expect(@rv[:path]).to eq(path)
620
612
  end
621
613
 
622
614
  it %[should have created a ephemeral node] do
623
615
  st = zk.stat(:path => path)
624
- st[:rc].should == Zookeeper::ZOK
616
+ expect(st[:rc]).to eq(Zookeeper::ZOK)
625
617
 
626
- st[:stat].ephemeral_owner.should_not be_zero
618
+ expect(st[:stat].ephemeral_owner).not_to be_zero
627
619
  end
628
620
  end
629
621
 
@@ -641,14 +633,14 @@ shared_examples_for "connection" do
641
633
  end
642
634
 
643
635
  it %[should return the path that was set] do
644
- @rv[:path].should_not == @orig_path
636
+ expect(@rv[:path]).not_to eq(@orig_path)
645
637
  end
646
638
 
647
639
  it %[should have created a permanent node] do
648
640
  st = zk.stat(:path => @s_path)
649
- st[:rc].should == Zookeeper::ZOK
641
+ expect(st[:rc]).to eq(Zookeeper::ZOK)
650
642
 
651
- st[:stat].ephemeral_owner.should be_zero
643
+ expect(st[:stat].ephemeral_owner).to be_zero
652
644
  end
653
645
  end
654
646
 
@@ -666,18 +658,18 @@ shared_examples_for "connection" do
666
658
  end
667
659
 
668
660
  it %[should return the path that was set] do
669
- @rv[:path].should_not == @orig_path
661
+ expect(@rv[:path]).not_to eq(@orig_path)
670
662
  end
671
663
 
672
664
  it %[should have created an ephemeral node] do
673
665
  st = zk.stat(:path => @s_path)
674
- st[:rc].should == Zookeeper::ZOK
666
+ expect(st[:rc]).to eq(Zookeeper::ZOK)
675
667
 
676
- st[:stat].ephemeral_owner.should_not be_zero
668
+ expect(st[:stat].ephemeral_owner).not_to be_zero
677
669
  end
678
670
  end
679
671
 
680
- describe :acl do
672
+ xdescribe :acl do
681
673
  it %[should work] do
682
674
  pending "need to write acl tests"
683
675
  end
@@ -695,22 +687,22 @@ shared_examples_for "connection" do
695
687
  before do
696
688
  @rv = zk.create(:path => path, :callback => @cb, :callback_context => path)
697
689
  wait_until(2) { @cb.completed? }
698
- @cb.should be_completed
690
+ expect(@cb).to be_completed
699
691
  end
700
692
 
701
693
  it %[should have a path] do
702
- @cb.path.should_not be_nil
694
+ expect(@cb.path).not_to be_nil
703
695
  end
704
696
 
705
697
  it %[should return the path that was set] do
706
- @cb.path.should == path
698
+ expect(@cb.path).to eq(path)
707
699
  end
708
700
 
709
701
  it %[should have created a permanent node] do
710
702
  st = zk.stat(:path => path)
711
- st[:rc].should == Zookeeper::ZOK
703
+ expect(st[:rc]).to eq(Zookeeper::ZOK)
712
704
 
713
- st[:stat].ephemeral_owner.should == 0
705
+ expect(st[:stat].ephemeral_owner).to eq(0)
714
706
  end
715
707
  end
716
708
 
@@ -718,9 +710,9 @@ shared_examples_for "connection" do
718
710
  it %[should barf if the data size is too large], :input_size => true do
719
711
  large_data = '0' * (1024 ** 2)
720
712
 
721
- lambda do
713
+ expect do
722
714
  zk.create(:path => path, :data => large_data, :callback => @cb, :callback_context => path)
723
- end.should raise_error(Zookeeper::Exceptions::DataTooLargeException)
715
+ end.to raise_error(Zookeeper::Exceptions::DataTooLargeException)
724
716
  end
725
717
  end
726
718
 
@@ -731,22 +723,22 @@ shared_examples_for "connection" do
731
723
  before do
732
724
  @rv = zk.create(:path => path, :ephemeral => true, :callback => @cb, :callback_context => path)
733
725
  wait_until(2) { @cb.completed? }
734
- @cb.should be_completed
726
+ expect(@cb).to be_completed
735
727
  end
736
728
 
737
729
  it %[should have a path] do
738
- @cb.path.should_not be_nil
730
+ expect(@cb.path).not_to be_nil
739
731
  end
740
732
 
741
733
  it %[should return the path that was set] do
742
- @cb.path.should == path
734
+ expect(@cb.path).to eq(path)
743
735
  end
744
736
 
745
737
  it %[should have created a ephemeral node] do
746
738
  st = zk.stat(:path => path)
747
- st[:rc].should == Zookeeper::ZOK
739
+ expect(st[:rc]).to eq(Zookeeper::ZOK)
748
740
 
749
- st[:stat].ephemeral_owner.should_not be_zero
741
+ expect(st[:stat].ephemeral_owner).not_to be_zero
750
742
  end
751
743
  end
752
744
 
@@ -758,7 +750,7 @@ shared_examples_for "connection" do
758
750
  @rv = zk.create(:path => path, :sequence => true, :callback => @cb, :callback_context => path)
759
751
 
760
752
  wait_until(2) { @cb.completed? }
761
- @cb.should be_completed
753
+ expect(@cb).to be_completed
762
754
 
763
755
  @s_path = @cb.path
764
756
  end
@@ -768,18 +760,18 @@ shared_examples_for "connection" do
768
760
  end
769
761
 
770
762
  it %[should have a path] do
771
- @cb.path.should_not be_nil
763
+ expect(@cb.path).not_to be_nil
772
764
  end
773
765
 
774
766
  it %[should return the path that was set] do
775
- @cb.path.should_not == @orig_path
767
+ expect(@cb.path).not_to eq(@orig_path)
776
768
  end
777
769
 
778
770
  it %[should have created a permanent node] do
779
771
  st = zk.stat(:path => @s_path)
780
- st[:rc].should == Zookeeper::ZOK
772
+ expect(st[:rc]).to eq(Zookeeper::ZOK)
781
773
 
782
- st[:stat].ephemeral_owner.should be_zero
774
+ expect(st[:stat].ephemeral_owner).to be_zero
783
775
  end
784
776
  end
785
777
 
@@ -792,7 +784,7 @@ shared_examples_for "connection" do
792
784
  path = @rv[:path] # make sure this gets cleaned up
793
785
 
794
786
  wait_until(2) { @cb.completed? }
795
- @cb.should be_completed
787
+ expect(@cb).to be_completed
796
788
  @s_path = @cb.path
797
789
  end
798
790
 
@@ -801,18 +793,18 @@ shared_examples_for "connection" do
801
793
  end
802
794
 
803
795
  it %[should have a path] do
804
- @cb.path.should_not be_nil
796
+ expect(@cb.path).not_to be_nil
805
797
  end
806
798
 
807
799
  it %[should return the path that was set] do
808
- @s_path.should_not == @orig_path
800
+ expect(@s_path).not_to eq(@orig_path)
809
801
  end
810
802
 
811
803
  it %[should have created an ephemeral node] do
812
804
  st = zk.stat(:path => @s_path)
813
- st[:rc].should == Zookeeper::ZOK
805
+ expect(st[:rc]).to eq(Zookeeper::ZOK)
814
806
 
815
- st[:stat].ephemeral_owner.should_not be_zero
807
+ expect(st[:stat].ephemeral_owner).not_to be_zero
816
808
  end
817
809
  end # ephemeral_sequence
818
810
  end # async
@@ -829,7 +821,7 @@ shared_examples_for "connection" do
829
821
  end
830
822
 
831
823
  it %[should have deleted the node] do
832
- zk.stat(:path => path)[:stat].exists.should be_false
824
+ expect(zk.stat(:path => path)[:stat].exists).to be_falsey
833
825
  end
834
826
  end
835
827
 
@@ -840,13 +832,13 @@ shared_examples_for "connection" do
840
832
  zk.create(:path => path)
841
833
 
842
834
  @stat = zk.stat(:path => path)[:stat]
843
- @stat.exists.should be_true
835
+ expect(@stat.exists).to be_truthy
844
836
 
845
837
  @rv = zk.delete(:path => path, :version => @stat.version)
846
838
  end
847
839
 
848
840
  it %[should have deleted the node] do
849
- zk.stat(:path => path)[:stat].exists.should be_false
841
+ expect(zk.stat(:path => path)[:stat].exists).to be_falsey
850
842
  end
851
843
  end
852
844
 
@@ -858,7 +850,7 @@ shared_examples_for "connection" do
858
850
  end
859
851
 
860
852
  it %[should have a return code of ZBADVERSION] do
861
- @rv[:rc].should == Zookeeper::ZBADVERSION
853
+ expect(@rv[:rc]).to eq(Zookeeper::ZBADVERSION)
862
854
  end
863
855
  end
864
856
  end # sync
@@ -874,15 +866,15 @@ shared_examples_for "connection" do
874
866
  before do
875
867
  @rv = zk.delete(:path => path, :callback => @cb, :callback_context => path)
876
868
  wait_until { @cb.completed? }
877
- @cb.should be_completed
869
+ expect(@cb).to be_completed
878
870
  end
879
871
 
880
872
  it %[should have a success return_code] do
881
- @cb.return_code.should == Zookeeper::ZOK
873
+ expect(@cb.return_code).to eq(Zookeeper::ZOK)
882
874
  end
883
875
 
884
876
  it %[should have deleted the node] do
885
- zk.stat(:path => path)[:stat].exists.should be_false
877
+ expect(zk.stat(:path => path)[:stat].exists).to be_falsey
886
878
  end
887
879
  end
888
880
 
@@ -893,15 +885,15 @@ shared_examples_for "connection" do
893
885
  @stat = zk.stat(:path => path)[:stat]
894
886
  @rv = zk.delete(:path => path, :version => @stat.version, :callback => @cb, :callback_context => path)
895
887
  wait_until { @cb.completed? }
896
- @cb.should be_completed
888
+ expect(@cb).to be_completed
897
889
  end
898
890
 
899
891
  it %[should have a success return_code] do
900
- @cb.return_code.should == Zookeeper::ZOK
892
+ expect(@cb.return_code).to eq(Zookeeper::ZOK)
901
893
  end
902
894
 
903
895
  it %[should have deleted the node] do
904
- zk.stat(:path => path)[:stat].exists.should be_false
896
+ expect(zk.stat(:path => path)[:stat].exists).to be_falsey
905
897
  end
906
898
  end
907
899
 
@@ -911,11 +903,11 @@ shared_examples_for "connection" do
911
903
 
912
904
  @rv = zk.delete(:path => path, :version => 0, :callback => @cb, :callback_context => path)
913
905
  wait_until { @cb.completed? }
914
- @cb.should be_completed
906
+ expect(@cb).to be_completed
915
907
  end
916
908
 
917
909
  it %[should have a return code of ZBADVERSION] do
918
- @cb.return_code.should == Zookeeper::ZBADVERSION
910
+ expect(@cb.return_code).to eq(Zookeeper::ZBADVERSION)
919
911
  end
920
912
  end
921
913
  end # async
@@ -930,19 +922,19 @@ shared_examples_for "connection" do
930
922
  end
931
923
 
932
924
  it %[should return a stat for the path] do
933
- @rv[:stat].should be_kind_of(Zookeeper::Stat)
925
+ expect(@rv[:stat]).to be_kind_of(Zookeeper::Stat)
934
926
  end
935
927
 
936
928
  it %[should return the acls] do
937
929
  acls = @rv[:acl]
938
- acls.should be_kind_of(Array)
930
+ expect(acls).to be_kind_of(Array)
939
931
  h = acls.first
940
932
 
941
- h.should be_kind_of(Hash)
933
+ expect(h).to be_kind_of(Hash)
942
934
 
943
- h[:perms].should == Zookeeper::ZOO_PERM_ALL
944
- h[:id][:scheme].should == 'world'
945
- h[:id][:id].should == 'anyone'
935
+ expect(h[:perms]).to eq(Zookeeper::ZOO_PERM_ALL)
936
+ expect(h[:id][:scheme]).to eq('world')
937
+ expect(h[:id][:id]).to eq('anyone')
946
938
  end
947
939
  end
948
940
 
@@ -954,29 +946,29 @@ shared_examples_for "connection" do
954
946
  @rv = zk.get_acl(:path => path, :callback => @cb, :callback_context => path)
955
947
 
956
948
  wait_until(2) { @cb.completed? }
957
- @cb.should be_completed
949
+ expect(@cb).to be_completed
958
950
  end
959
951
 
960
952
  it %[should return a stat for the path] do
961
- @cb.stat.should be_kind_of(Zookeeper::Stat)
953
+ expect(@cb.stat).to be_kind_of(Zookeeper::Stat)
962
954
  end
963
955
 
964
956
  it %[should return the acls] do
965
957
  acls = @cb.acl
966
- acls.should be_kind_of(Array)
958
+ expect(acls).to be_kind_of(Array)
967
959
 
968
960
  acl = acls.first
969
- acl.should be_kind_of(Zookeeper::ACLs::ACL)
961
+ expect(acl).to be_kind_of(Zookeeper::ACLs::ACL)
970
962
 
971
- acl.perms.should == Zookeeper::ZOO_PERM_ALL
963
+ expect(acl.perms).to eq(Zookeeper::ZOO_PERM_ALL)
972
964
 
973
- acl.id.scheme.should == 'world'
974
- acl.id.id.should == 'anyone'
965
+ expect(acl.id.scheme).to eq('world')
966
+ expect(acl.id.id).to eq('anyone')
975
967
  end
976
968
  end
977
969
  end
978
970
 
979
- describe :set_acl do
971
+ xdescribe :set_acl do
980
972
  before do
981
973
  @perms = 5
982
974
  @new_acl = [Zookeeper::ACLs::ACL.new(:perms => @perms, :id => Zookeeper::Constants::ZOO_ANYONE_ID_UNSAFE)]
@@ -994,13 +986,13 @@ shared_examples_for "connection" do
994
986
 
995
987
  describe :session_id do
996
988
  it %[should return the session_id as a Fixnum] do
997
- zk.session_id.should be_kind_of(Integer)
989
+ expect(zk.session_id).to be_kind_of(Integer)
998
990
  end
999
991
  end
1000
992
 
1001
993
  describe :session_passwd do
1002
994
  it %[should return the session passwd as a String] do
1003
- zk.session_passwd.should be_kind_of(String)
995
+ expect(zk.session_passwd).to be_kind_of(String)
1004
996
  end
1005
997
  end
1006
998
 
@@ -1013,13 +1005,13 @@ shared_examples_for "connection" do
1013
1005
  @rv = zk.sync(:path => path, :callback => @cb)
1014
1006
 
1015
1007
  wait_until(2) { @cb.completed }
1016
- @cb.should be_completed
1008
+ expect(@cb).to be_completed
1017
1009
  end
1018
1010
  end
1019
1011
 
1020
1012
  describe :errors do
1021
1013
  it %[should barf with BadArguments if :callback is not given] do
1022
- lambda { zk.sync(:path => path) }.should raise_error(Zookeeper::Exceptions::BadArguments)
1014
+ expect { zk.sync(:path => path) }.to raise_error(Zookeeper::Exceptions::BadArguments)
1023
1015
  end
1024
1016
  end
1025
1017
  end
@@ -1034,11 +1026,11 @@ shared_examples_for "connection" do
1034
1026
 
1035
1027
  @rv = zk.sync(:path => path, :callback => cb)
1036
1028
 
1037
- wait_until(2) { @result == true }.should be_true
1029
+ expect(wait_until(2) { @result == true }).to be_truthy
1038
1030
  end
1039
1031
 
1040
1032
  it %[should return false when not on the event dispatching thread] do
1041
- zk.event_dispatch_thread?.should_not be_true
1033
+ expect(zk.event_dispatch_thread?).not_to be_truthy
1042
1034
  end
1043
1035
  end
1044
1036
 
@@ -1058,7 +1050,7 @@ shared_examples_for "connection" do
1058
1050
  end
1059
1051
 
1060
1052
  wait_until { zk.closed? }
1061
- zk.should be_closed
1053
+ expect(zk).to be_closed
1062
1054
  end
1063
1055
  end
1064
1056
  end
@@ -1068,11 +1060,11 @@ shared_examples_for "connection" do
1068
1060
  it %[should raise an InheritedConnectionError if the current Process.pid is different from the one that created the client] do
1069
1061
  pid = Process.pid
1070
1062
  begin
1071
- Process.stub(:pid => -1)
1072
- lambda { zk.stat(:path => path) }.should raise_error(Zookeeper::Exceptions::InheritedConnectionError)
1063
+ allow(Process).to receive(:pid).and_return(-1)
1064
+ expect { zk.stat(:path => path) }.to raise_error(Zookeeper::Exceptions::InheritedConnectionError)
1073
1065
  ensure
1074
1066
  # ensure we reset this, only want it to fail during the test
1075
- Process.stub(:pid => pid)
1067
+ allow(Process).to receive(:pid).and_return(pid)
1076
1068
  end
1077
1069
  end
1078
1070
  end