ione 1.2.2 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -91,7 +91,7 @@ module Ione
91
91
  promise.try do
92
92
  3 + 4
93
93
  end
94
- promise.future.value.should == 7
94
+ promise.future.value.should eq(7)
95
95
  end
96
96
 
97
97
  it 'fails the promise when the block raises an error' do
@@ -105,7 +105,7 @@ module Ione
105
105
  promise.try(:foo, 3) do |a, b|
106
106
  a.length + b
107
107
  end
108
- promise.future.value.should == 6
108
+ promise.future.value.should eq(6)
109
109
  end
110
110
 
111
111
  it 'returns nil' do
@@ -216,8 +216,8 @@ module Ione
216
216
  future.on_complete { |v, _| v1 = v }
217
217
  future.on_complete { |v, _| v2 = v }
218
218
  promise.fulfill('bar')
219
- v1.should == 'bar'
220
- v2.should == 'bar'
219
+ v1.should eq('bar')
220
+ v2.should eq('bar')
221
221
  end
222
222
 
223
223
  it 'passes future as the third parameter to the block when it expects three arguments' do
@@ -319,15 +319,15 @@ module Ione
319
319
  future.on_complete { |f| raise 'Blurgh' }
320
320
  future.on_complete { |f| value = f.value }
321
321
  promise.fulfill('bar')
322
- value.should == 'bar'
322
+ value.should eq('bar')
323
323
  end
324
324
 
325
325
  it 'notifies all listeners when the promise fails, even when one raises an error' do
326
326
  err = nil
327
327
  future.on_complete { |f| raise 'Blurgh' }
328
- future.on_complete { |f| begin; f.value; rescue => err; e = err; end }
328
+ future.on_complete { |f| begin; f.value; rescue => e; err = e; end }
329
329
  promise.fail(error)
330
- err.message.should == 'bork'
330
+ err.message.should eq('bork')
331
331
  end
332
332
 
333
333
  it 'notifies listeners registered after the promise was fulfilled' do
@@ -335,7 +335,7 @@ module Ione
335
335
  promise.fulfill('bar')
336
336
  future.on_complete { |vv, ee, ff| v = vv; e = ee; f = ff }
337
337
  f.should equal(future)
338
- v.should == 'bar'
338
+ v.should eq('bar')
339
339
  e.should be_nil
340
340
  end
341
341
 
@@ -345,7 +345,7 @@ module Ione
345
345
  future.on_complete { |vv, ee, ff| v = vv; e = ee; f = ff }
346
346
  f.should equal(future)
347
347
  v.should be_nil
348
- e.message.should == 'bork'
348
+ e.message.should eq('bork')
349
349
  end
350
350
 
351
351
  it 'notifies listeners registered after the promise failed' do
@@ -376,8 +376,8 @@ module Ione
376
376
  future.on_value { |v| v1 = v }
377
377
  future.on_value { |v| v2 = v }
378
378
  promise.fulfill('bar')
379
- v1.should == 'bar'
380
- v2.should == 'bar'
379
+ v1.should eq('bar')
380
+ v2.should eq('bar')
381
381
  end
382
382
 
383
383
  it 'notifies all listeners even when one raises an error' do
@@ -385,7 +385,7 @@ module Ione
385
385
  future.on_value { |v| raise 'Blurgh' }
386
386
  future.on_value { |v| value = v }
387
387
  promise.fulfill('bar')
388
- value.should == 'bar'
388
+ value.should eq('bar')
389
389
  end
390
390
 
391
391
  it 'notifies listeners registered after the promise was resolved' do
@@ -393,8 +393,8 @@ module Ione
393
393
  promise.fulfill('bar')
394
394
  future.on_value { |v| v1 = v }
395
395
  future.on_value { |v| v2 = v }
396
- v1.should == 'bar'
397
- v2.should == 'bar'
396
+ v1.should eq('bar')
397
+ v2.should eq('bar')
398
398
  end
399
399
 
400
400
  it 'does not raise any error when the listener raises an error when already resolved' do
@@ -479,7 +479,7 @@ module Ione
479
479
  p.fulfill('bar')
480
480
  end
481
481
  d.value
482
- future.value.should == 'bar'
482
+ future.value.should eq('bar')
483
483
  end
484
484
 
485
485
  it 'blocks on #value until completed, when value is nil' do
@@ -506,7 +506,7 @@ module Ione
506
506
  end
507
507
  sleep 0.1
508
508
  promise.fulfill(:hello)
509
- listeners.map(&:value).should == Array.new(10, :hello)
509
+ listeners.map(&:value).should eq(Array.new(10, :hello))
510
510
  end
511
511
 
512
512
  it 'is aliased as #get' do
@@ -524,7 +524,7 @@ module Ione
524
524
  f = p.future.map { |v| v * 2 }
525
525
  f.on_value { |v| mapped_value = v }
526
526
  p.fulfill(3)
527
- mapped_value.should == 3 * 2
527
+ mapped_value.should eq(3 * 2)
528
528
  end
529
529
 
530
530
  it 'will be resolved with the specified value' do
@@ -533,7 +533,7 @@ module Ione
533
533
  f = p.future.map(7)
534
534
  f.on_value { |v| mapped_value = v }
535
535
  p.fulfill(3)
536
- mapped_value.should == 7
536
+ mapped_value.should eq(7)
537
537
  end
538
538
 
539
539
  it 'will be resolved with the result of the given block, even if a value is specified' do
@@ -542,7 +542,7 @@ module Ione
542
542
  f = p.future.map(7) { |v| v * 2 }
543
543
  f.on_value { |v| mapped_value = v }
544
544
  p.fulfill(3)
545
- mapped_value.should == 3 * 2
545
+ mapped_value.should eq(3 * 2)
546
546
  end
547
547
 
548
548
  it 'will be resolved with nil when neither value nor block is specified' do
@@ -581,7 +581,7 @@ module Ione
581
581
  p = Promise.new
582
582
  f = p.future.flat_map { |v| Future.resolved(v * 2) }
583
583
  p.fulfill(3)
584
- f.value.should == 3 * 2
584
+ f.value.should eq(3 * 2)
585
585
  end
586
586
 
587
587
  it 'fails when the block raises an error' do
@@ -598,7 +598,7 @@ module Ione
598
598
  p = Promise.new
599
599
  f = p.future.flat_map { fake_future }
600
600
  p.fulfill
601
- f.value.should == :foobar
601
+ f.value.should eq(:foobar)
602
602
  end
603
603
  end
604
604
 
@@ -608,7 +608,7 @@ module Ione
608
608
  p = Promise.new
609
609
  f = p.future.then { |v| Future.resolved(v * 2) }
610
610
  p.fulfill(3)
611
- f.value.should == 3 * 2
611
+ f.value.should eq(3 * 2)
612
612
  end
613
613
  end
614
614
 
@@ -620,7 +620,7 @@ module Ione
620
620
  p = Promise.new
621
621
  f = p.future.then { |v| fake_future }
622
622
  p.fulfill
623
- f.value.should == :foobar
623
+ f.value.should eq(:foobar)
624
624
  end
625
625
  end
626
626
 
@@ -641,7 +641,7 @@ module Ione
641
641
  p = Promise.new
642
642
  f = p.future.then { |v| v * 2 }
643
643
  p.fulfill(3)
644
- f.value.should == 3 * 2
644
+ f.value.should eq(3 * 2)
645
645
  end
646
646
  end
647
647
 
@@ -662,21 +662,21 @@ module Ione
662
662
  p = Promise.new
663
663
  f = p.future.recover { 'foo' }
664
664
  p.fail(error)
665
- f.value.should == 'foo'
665
+ f.value.should eq('foo')
666
666
  end
667
667
 
668
668
  it 'resolves to a specfied value when the source future fails' do
669
669
  p = Promise.new
670
670
  f = p.future.recover('bar')
671
671
  p.fail(error)
672
- f.value.should == 'bar'
672
+ f.value.should eq('bar')
673
673
  end
674
674
 
675
675
  it 'resovles to a value created by the block even when a value is specified when the source future fails' do
676
676
  p = Promise.new
677
677
  f = p.future.recover('bar') { 'foo' }
678
678
  p.fail(error)
679
- f.value.should == 'foo'
679
+ f.value.should eq('foo')
680
680
  end
681
681
 
682
682
  it 'resolves to nil value when no value nor block is specified and the source future fails' do
@@ -690,14 +690,14 @@ module Ione
690
690
  p = Promise.new
691
691
  f = p.future.recover { |e| e.message }
692
692
  p.fail(error)
693
- f.value.should == error.message
693
+ f.value.should eq(error.message)
694
694
  end
695
695
 
696
696
  it 'resolves to the value of the source future when the source future is resolved' do
697
697
  p = Promise.new
698
698
  f = p.future.recover { 'foo' }
699
699
  p.fulfill('bar')
700
- f.value.should == 'bar'
700
+ f.value.should eq('bar')
701
701
  end
702
702
 
703
703
  it 'fails with the error raised in the given block' do
@@ -717,17 +717,16 @@ module Ione
717
717
  f = p1.future.fallback { p2.future }
718
718
  p1.fail(error)
719
719
  p2.fulfill('foo')
720
- f.value.should == 'foo'
720
+ f.value.should eq('foo')
721
721
  end
722
722
 
723
723
  it 'yields the error to the block' do
724
- p1 = Promise.new
725
- p2 = Promise.new
726
- f = p1.future.fallback do |error|
724
+ p = Promise.new
725
+ f = p.future.fallback do |error|
727
726
  Future.resolved(error.message)
728
727
  end
729
- p1.fail(error)
730
- f.value.should == error.message
728
+ p.fail(error)
729
+ f.value.should eq(error.message)
731
730
  end
732
731
 
733
732
  it 'is resolved with the value of the source future when the source future fullfills' do
@@ -736,7 +735,7 @@ module Ione
736
735
  f = p1.future.fallback { p2.future }
737
736
  p2.fulfill('bar')
738
737
  p1.fulfill('foo')
739
- f.value.should == 'foo'
738
+ f.value.should eq('foo')
740
739
  end
741
740
 
742
741
  it 'fails when the block raises an error' do
@@ -761,7 +760,7 @@ module Ione
761
760
  p = Promise.new
762
761
  f = p.future.fallback { fake_future }
763
762
  p.fail(error)
764
- f.value.should == 'foo'
763
+ f.value.should eq('foo')
765
764
  end
766
765
  end
767
766
  end
@@ -771,7 +770,7 @@ module Ione
771
770
  future = Future.traverse([1, 2, 3]) do |element|
772
771
  Future.resolved(element * 2)
773
772
  end
774
- future.value.should == [2, 4, 6]
773
+ future.value.should eq([2, 4, 6])
775
774
  end
776
775
 
777
776
  it 'fails if any of the source futures fail' do
@@ -800,12 +799,12 @@ module Ione
800
799
  fake_future = double(:fake_future)
801
800
  fake_future.stub(:on_complete) { |&listener| listener.call(:foobar, nil) }
802
801
  future = Future.traverse([1, 2, 3]) { fake_future }
803
- future.value.should == [:foobar, :foobar, :foobar]
802
+ future.value.should eq([:foobar, :foobar, :foobar])
804
803
  end
805
804
 
806
805
  it 'accepts an enumerable of values' do
807
806
  future = Future.traverse([1, 2, 3].to_enum) { |v| Future.resolved(v * 2) }
808
- future.value.should == [2, 4, 6]
807
+ future.value.should eq([2, 4, 6])
809
808
  end
810
809
  end
811
810
 
@@ -819,7 +818,7 @@ module Ione
819
818
  future = Future.reduce(futures, {}) do |accumulator, value|
820
819
  accumulator.merge(value)
821
820
  end
822
- future.value.should == {'foo' => 'bar', 'qux' => 'baz', 'hello' => 'world'}
821
+ future.value.should eq({'foo' => 'bar', 'qux' => 'baz', 'hello' => 'world'})
823
822
  end
824
823
 
825
824
  it 'accepts boolean accumulators' do
@@ -830,7 +829,7 @@ module Ione
830
829
  future = Future.reduce(futures, false) do |accumulator, value|
831
830
  accumulator || value.empty?
832
831
  end
833
- future.value.should == true
832
+ future.value.should eq(true)
834
833
  end
835
834
 
836
835
  it 'calls the block with the values in the order of the source futures' do
@@ -844,7 +843,7 @@ module Ione
844
843
  promises[2].fulfill(2)
845
844
  promises[4].fulfill(4)
846
845
  promises[3].fulfill(3)
847
- future.value.should == [0, 1, 2, 3, 4]
846
+ future.value.should eq([0, 1, 2, 3, 4])
848
847
  end
849
848
 
850
849
  it 'uses the first value as initial value when no intial value is given' do
@@ -856,7 +855,7 @@ module Ione
856
855
  promises[1].fulfill(2)
857
856
  promises[0].fulfill(1)
858
857
  promises[2].fulfill(3)
859
- future.value.should == 6
858
+ future.value.should eq(6)
860
859
  end
861
860
 
862
861
  it 'fails if any of the source futures fail' do
@@ -893,7 +892,7 @@ module Ione
893
892
 
894
893
  context 'when the list of futures is empty' do
895
894
  it 'returns a future that resolves to the initial value' do
896
- Future.reduce([], :foo).value.should == :foo
895
+ Future.reduce([], :foo).value.should eq(:foo)
897
896
  end
898
897
 
899
898
  it 'returns a future that resolves to nil there is also no initial value' do
@@ -907,13 +906,19 @@ module Ione
907
906
  ff2.stub(:on_complete) { |&listener| listener.call(2, nil) }
908
907
  ff3.stub(:on_complete) { |&listener| listener.call(3, nil) }
909
908
  future = Future.reduce([ff1, ff2, ff3], 0) { |sum, n| sum + n }
910
- future.value.should == 6
909
+ future.value.should eq(6)
911
910
  end
912
911
 
913
912
  it 'accepts an enumerable of futures' do
914
913
  futures = [Future.resolved(1), Future.resolved(2), Future.resolved(3)].to_enum
915
914
  future = Future.reduce(futures, 0) { |sum, n| sum + n }
916
- future.value.should == 6
915
+ future.value.should eq(6)
916
+ end
917
+
918
+ it 'handles a really long list of futures' do
919
+ futures = Array.new(10000, Future.resolved(1))
920
+ future = Future.reduce(futures, 0, &:+)
921
+ future.value.should eq(10000)
917
922
  end
918
923
 
919
924
  context 'when the :ordered option is false' do
@@ -926,7 +931,7 @@ module Ione
926
931
  promises[1].fulfill(1)
927
932
  promises[0].fulfill(0)
928
933
  promises[2].fulfill(2)
929
- future.value.should == [1, 0, 2]
934
+ future.value.should eq([1, 0, 2])
930
935
  end
931
936
 
932
937
  it 'fails if any of the source futures fail' do
@@ -949,9 +954,15 @@ module Ione
949
954
  future.should be_failed
950
955
  end
951
956
 
957
+ it 'handles a really long list of futures' do
958
+ futures = Array.new(10000, Future.resolved(1))
959
+ future = Future.reduce(futures, 0, ordered: false, &:+)
960
+ future.value.should eq(10000)
961
+ end
962
+
952
963
  context 'when the list of futures is empty' do
953
964
  it 'returns a future that resolves to the initial value' do
954
- Future.reduce([], :foo, ordered: false).value.should == :foo
965
+ Future.reduce([], :foo, ordered: false).value.should eq(:foo)
955
966
  end
956
967
 
957
968
  it 'returns a future that resolves to nil there is also no initial value' do
@@ -1076,7 +1087,7 @@ module Ione
1076
1087
  p2.fulfill(2)
1077
1088
  p1.fulfill(1)
1078
1089
  p3.fulfill(3)
1079
- f.value.should == [1, 2, 3]
1090
+ f.value.should eq([1, 2, 3])
1080
1091
  end
1081
1092
 
1082
1093
  it 'fails if any of the source futures fail' do
@@ -1094,20 +1105,20 @@ module Ione
1094
1105
  end
1095
1106
 
1096
1107
  it 'completes with an empty list when no futures are given' do
1097
- Future.all.value.should == []
1108
+ Future.all.value.should eq([])
1098
1109
  end
1099
1110
 
1100
1111
  it 'completes with an empty list when an empty list is given' do
1101
- Future.all([]).value.should == []
1112
+ Future.all([]).value.should eq([])
1102
1113
  end
1103
1114
 
1104
1115
  it 'completes with an empty list when an empty enumerable is given' do
1105
- Future.all([].to_enum).value.should == []
1116
+ Future.all([].to_enum).value.should eq([])
1106
1117
  end
1107
1118
 
1108
1119
  it 'completes with a list of one item when a single future is given' do
1109
1120
  f = Future.resolved(1)
1110
- Future.all(f).value.should == [1]
1121
+ Future.all(f).value.should eq([1])
1111
1122
  end
1112
1123
 
1113
1124
  it 'accepts a list of futures' do
@@ -1140,7 +1151,7 @@ module Ione
1140
1151
  ff2.stub(:on_complete) { |&listener| listener.call(2, nil) }
1141
1152
  ff3.stub(:on_complete) { |&listener| listener.call(3, nil) }
1142
1153
  future = Future.all(ff1, ff2, ff3)
1143
- future.value.should == [1, 2, 3]
1154
+ future.value.should eq([1, 2, 3])
1144
1155
  end
1145
1156
  end
1146
1157
  end
@@ -1162,7 +1173,7 @@ module Ione
1162
1173
  p3 = Promise.new
1163
1174
  f = Future.first(p1.future, p2.future, p3.future)
1164
1175
  p2.fulfill('foo')
1165
- f.value.should == 'foo'
1176
+ f.value.should eq('foo')
1166
1177
  end
1167
1178
 
1168
1179
  it 'is unaffected by the fullfillment of the other futures' do
@@ -1214,7 +1225,7 @@ module Ione
1214
1225
  end
1215
1226
 
1216
1227
  it 'completes with the value of the given future, when only one is given' do
1217
- Future.first(Future.resolved('foo')).value.should == 'foo'
1228
+ Future.first(Future.resolved('foo')).value.should eq('foo')
1218
1229
  end
1219
1230
 
1220
1231
  it 'accepts a list of futures' do
@@ -1238,7 +1249,7 @@ module Ione
1238
1249
  ff1.stub(:on_complete) { |&listener| listener.call(1, nil) }
1239
1250
  ff2.stub(:on_complete) { |&listener| listener.call(2, nil) }
1240
1251
  future = Future.first(ff1, ff2)
1241
- future.value.should == 1
1252
+ future.value.should eq(1)
1242
1253
  end
1243
1254
  end
1244
1255
  end
@@ -1264,14 +1275,14 @@ module Ione
1264
1275
  it 'calls its value callbacks immediately' do
1265
1276
  value = nil
1266
1277
  future.on_value { |v| value = v }
1267
- value.should == 'hello world'
1278
+ value.should eq('hello world')
1268
1279
  end
1269
1280
 
1270
1281
  it 'calls its complete callbacks immediately' do
1271
1282
  f, v = nil, nil
1272
1283
  future.on_complete { |vv, _, ff| f = ff; v = vv }
1273
1284
  f.should equal(future)
1274
- v.should == 'hello world'
1285
+ v.should eq('hello world')
1275
1286
  end
1276
1287
 
1277
1288
  it 'calls its complete callbacks with the right arity' do
@@ -1281,11 +1292,11 @@ module Ione
1281
1292
  future.on_complete { |vv, ee, ff| f2 = ff }
1282
1293
  f1.should equal(future)
1283
1294
  f2.should equal(future)
1284
- v.should == 'hello world'
1295
+ v.should eq('hello world')
1285
1296
  end
1286
1297
 
1287
1298
  it 'does not block on #value' do
1288
- future.value.should == 'hello world'
1299
+ future.value.should eq('hello world')
1289
1300
  end
1290
1301
 
1291
1302
  it 'defaults to the value nil' do
@@ -1315,14 +1326,14 @@ module Ione
1315
1326
  it 'call its failure callbacks immediately' do
1316
1327
  error = nil
1317
1328
  future.on_failure { |e| error = e }
1318
- error.message.should == 'bork'
1329
+ error.message.should eq('bork')
1319
1330
  end
1320
1331
 
1321
1332
  it 'calls its complete callbacks immediately' do
1322
1333
  f, e = nil, nil
1323
1334
  future.on_complete { |_, ee, ff| f = ff; e = ee }
1324
1335
  f.should equal(future)
1325
- e.message.should == 'bork'
1336
+ e.message.should eq('bork')
1326
1337
  end
1327
1338
 
1328
1339
  it 'calls its complete callbacks with the right arity' do
@@ -1332,7 +1343,7 @@ module Ione
1332
1343
  future.on_complete { |vv, ee, ff| f2 = ff }
1333
1344
  f1.should equal(future)
1334
1345
  f2.should equal(future)
1335
- e.message.should == 'bork'
1346
+ e.message.should eq('bork')
1336
1347
  end
1337
1348
 
1338
1349
  it 'does not block on #value' do
@@ -17,9 +17,9 @@ module Ione
17
17
  it 'returns the number of items in the heap' do
18
18
  heap.push(13)
19
19
  heap.push(100)
20
- heap.size.should == 2
20
+ heap.size.should eq(2)
21
21
  heap.push(101)
22
- heap.size.should == 3
22
+ heap.size.should eq(3)
23
23
  end
24
24
  end
25
25
 
@@ -40,7 +40,7 @@ module Ione
40
40
  heap.push(3)
41
41
  heap.push(6)
42
42
  heap.push(5)
43
- heap.size.should == 4
43
+ heap.size.should eq(4)
44
44
  end
45
45
 
46
46
  it 'is aliased as #<<' do
@@ -48,14 +48,14 @@ module Ione
48
48
  heap << 3
49
49
  heap << 6
50
50
  heap << 5
51
- heap.size.should == 4
51
+ heap.size.should eq(4)
52
52
  end
53
53
 
54
54
  it 'does not add duplicates' do
55
55
  heap << 3
56
56
  heap << 3
57
57
  heap << 3
58
- heap.size.should == 1
58
+ heap.size.should eq(1)
59
59
  end
60
60
  end
61
61
 
@@ -66,21 +66,21 @@ module Ione
66
66
 
67
67
  it 'returns the only item when there is only one' do
68
68
  heap.push(3)
69
- heap.peek.should == 3
69
+ heap.peek.should eq(3)
70
70
  end
71
71
 
72
72
  it 'returns the smallest item' do
73
73
  heap.push(10)
74
74
  heap.push(3)
75
75
  heap.push(7)
76
- heap.peek.should == 3
76
+ heap.peek.should eq(3)
77
77
  end
78
78
 
79
79
  it 'does not remove the item from the heap' do
80
80
  heap.push(3)
81
- heap.peek.should == 3
82
- heap.peek.should == 3
83
- heap.peek.should == 3
81
+ heap.peek.should eq(3)
82
+ heap.peek.should eq(3)
83
+ heap.peek.should eq(3)
84
84
  end
85
85
  end
86
86
 
@@ -91,7 +91,7 @@ module Ione
91
91
 
92
92
  it 'returns and removes the only item when there is only one' do
93
93
  heap.push(3)
94
- heap.pop.should == 3
94
+ heap.pop.should eq(3)
95
95
  heap.should be_empty
96
96
  end
97
97
 
@@ -99,14 +99,14 @@ module Ione
99
99
  heap.push(10)
100
100
  heap.push(3)
101
101
  heap.push(7)
102
- heap.pop.should == 3
103
- heap.pop.should == 7
104
- heap.size.should == 1
102
+ heap.pop.should eq(3)
103
+ heap.pop.should eq(7)
104
+ heap.size.should eq(1)
105
105
  end
106
106
 
107
107
  it 'removes the item from the heap' do
108
108
  heap.push(3)
109
- heap.pop.should == 3
109
+ heap.pop.should eq(3)
110
110
  heap.pop.should be_nil
111
111
  end
112
112
  end
@@ -125,8 +125,8 @@ module Ione
125
125
  heap.push(101)
126
126
  heap.delete(4)
127
127
  heap.pop
128
- heap.peek.should == 100
129
- heap.size.should == 2
128
+ heap.peek.should eq(100)
129
+ heap.size.should eq(2)
130
130
  end
131
131
 
132
132
  it 'removes the last item from the heap' do
@@ -155,7 +155,7 @@ module Ione
155
155
  heap.push(3)
156
156
  heap.push(4)
157
157
  heap.push(5)
158
- heap.delete(4).should == 4
158
+ heap.delete(4).should eq(4)
159
159
  end
160
160
 
161
161
  it 'returns nil when the item is not found' do
@@ -174,8 +174,8 @@ module Ione
174
174
  acceptor.bind
175
175
  acceptor.read
176
176
  accepted_handlers.should have(1).item
177
- accepted_handlers.first.host.should == 'example.com'
178
- accepted_handlers.first.port.should == 3333
177
+ accepted_handlers.first.host.should eq('example.com')
178
+ accepted_handlers.first.port.should eq(3333)
179
179
  end
180
180
 
181
181
  it 'passes the unblocker along to the connection handler' do
@@ -197,9 +197,9 @@ module Ione
197
197
  acceptor.on_accept { |c| received_connection2 = c }
198
198
  acceptor.bind
199
199
  acceptor.read
200
- received_connection1.host.should == 'example.com'
201
- received_connection2.host.should == 'example.com'
202
- received_connection2.port.should == 3333
200
+ received_connection1.host.should eq('example.com')
201
+ received_connection2.host.should eq('example.com')
202
+ received_connection2.port.should eq(3333)
203
203
  end
204
204
 
205
205
  it 'ignores exceptions raised by the connection callback' do
@@ -40,7 +40,7 @@ shared_examples_for 'a connection' do |options|
40
40
  handler.on_closed { calls += 1 }
41
41
  handler.close
42
42
  handler.close
43
- calls.should == 1
43
+ calls.should eq(1)
44
44
  end
45
45
 
46
46
  it 'returns false if it did nothing' do
@@ -238,7 +238,7 @@ shared_examples_for 'a connection' do |options|
238
238
  data = nil
239
239
  handler.on_data { |d| data = d }
240
240
  handler.read
241
- data.should == 'foo bar'
241
+ data.should eq('foo bar')
242
242
  end
243
243
 
244
244
  context 'when #read_nonblock raises an error' do