must_be 1.0.3 → 1.1.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.
- checksums.yaml +7 -0
- data/ChangeLog.md +5 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +22 -0
- data/README.md +14 -14
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/doc/readme/examples.rb +13 -13
- data/lib/must_be.rb +2 -2
- data/lib/must_be/attr_typed.rb +1 -1
- data/lib/must_be/core.rb +1 -0
- data/must_be.gemspec +46 -57
- data/spec/must_be/attr_typed_spec.rb +14 -14
- data/spec/must_be/basic_spec.rb +22 -22
- data/spec/must_be/containers_spec.rb +10 -10
- data/spec/must_be/core_spec.rb +32 -22
- data/spec/must_be/nonstandard_control_flow_spec.rb +73 -71
- data/spec/must_be/proxy_spec.rb +13 -13
- data/spec/notify_matcher_spec.rb +1 -1
- data/spec/spec_helper.rb +11 -3
- data/spec/typical_usage_spec.rb +5 -5
- metadata +52 -81
- data/.gitignore +0 -2
@@ -9,7 +9,7 @@ describe MustBe do
|
|
9
9
|
it "should raise TypeError" do
|
10
10
|
expect do
|
11
11
|
:it.send(the_method_name, RangeError, :not_nil_string_or_regexp) {}
|
12
|
-
end.
|
12
|
+
end.to raise_error(TypeError, "nil, string, or regexp required")
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -17,7 +17,7 @@ describe MustBe do
|
|
17
17
|
it "should raise ArgumentError" do
|
18
18
|
expect do
|
19
19
|
:it.send(the_method_name, RangeError, "message", "trouble") {}
|
20
|
-
end.
|
20
|
+
end.to raise_error(ArgumentError,
|
21
21
|
"wrong number of arguments (3 for 2)")
|
22
22
|
end
|
23
23
|
end
|
@@ -26,7 +26,7 @@ describe MustBe do
|
|
26
26
|
it "should raise TypeError" do
|
27
27
|
expect do
|
28
28
|
:it.send(the_method_name, "message", "second_message") {}
|
29
|
-
end.
|
29
|
+
end.to raise_error(TypeError, "exception class expected")
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -34,7 +34,7 @@ describe MustBe do
|
|
34
34
|
it "should raise TypeError" do
|
35
35
|
expect do
|
36
36
|
:it.send(the_method_name, Range) {}
|
37
|
-
end.
|
37
|
+
end.to raise_error(TypeError, "exception class expected")
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -43,7 +43,7 @@ describe MustBe do
|
|
43
43
|
it "should raise TypeError" do
|
44
44
|
expect do
|
45
45
|
:it.send(the_method_name, :not_an_error_type) {}
|
46
|
-
end.
|
46
|
+
end.to raise_error(TypeError,
|
47
47
|
"exception class expected")
|
48
48
|
end
|
49
49
|
end
|
@@ -57,14 +57,14 @@ describe MustBe do
|
|
57
57
|
it "should not notify if any exception is raised" do
|
58
58
|
expect do
|
59
59
|
:it.must_raise { raise Exception }
|
60
|
-
end.
|
60
|
+
end.to raise_error(Exception)
|
61
61
|
should_not notify
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should notify if no exception is raised" do
|
65
65
|
called = false
|
66
66
|
:it.must_raise{called = true; :result}.should == :result
|
67
|
-
called.should
|
67
|
+
called.should be true
|
68
68
|
should notify(":it.must_raise {}, but nothing was raised")
|
69
69
|
end
|
70
70
|
end
|
@@ -73,7 +73,7 @@ describe MustBe do
|
|
73
73
|
it "should not notify if an exception of the same type is raised" do
|
74
74
|
expect do
|
75
75
|
:it.must_raise(TypeError) { raise TypeError }
|
76
|
-
end.
|
76
|
+
end.to raise_error(TypeError)
|
77
77
|
should_not notify
|
78
78
|
end
|
79
79
|
|
@@ -85,7 +85,7 @@ describe MustBe do
|
|
85
85
|
it "should notify if a different exception type is raised" do
|
86
86
|
expect do
|
87
87
|
:it.must_raise(TypeError) { raise ArgumentError }
|
88
|
-
end.
|
88
|
+
end.to raise_error(ArgumentError)
|
89
89
|
should notify(":it.must_raise(TypeError) {},"\
|
90
90
|
" but ArgumentError was raised")
|
91
91
|
end
|
@@ -96,7 +96,7 @@ describe MustBe do
|
|
96
96
|
" raised" do
|
97
97
|
expect do
|
98
98
|
:it.must_raise("message") { raise "message" }
|
99
|
-
end.
|
99
|
+
end.to raise_error(RuntimeError)
|
100
100
|
should_not notify
|
101
101
|
end
|
102
102
|
|
@@ -109,7 +109,7 @@ describe MustBe do
|
|
109
109
|
it "should notify if an exception with a different message is raised" do
|
110
110
|
expect do
|
111
111
|
:it.must_raise("message") { raise "wrong" }
|
112
|
-
end.
|
112
|
+
end.to raise_error(RuntimeError)
|
113
113
|
should notify(":it.must_raise(\"message\") {},"\
|
114
114
|
" but RuntimeError with message \"wrong\" was raised")
|
115
115
|
end
|
@@ -120,7 +120,7 @@ describe MustBe do
|
|
120
120
|
" raised" do
|
121
121
|
expect do
|
122
122
|
:it.must_raise(/message/) { raise "some message" }
|
123
|
-
end.
|
123
|
+
end.to raise_error(RuntimeError)
|
124
124
|
should_not notify
|
125
125
|
end
|
126
126
|
|
@@ -133,7 +133,7 @@ describe MustBe do
|
|
133
133
|
" is raised" do
|
134
134
|
expect do
|
135
135
|
:it.must_raise(/message/) { raise "mess" }
|
136
|
-
end.
|
136
|
+
end.to raise_error(RuntimeError)
|
137
137
|
should notify(":it.must_raise(/message/) {},"\
|
138
138
|
" but RuntimeError with message \"mess\" was raised")
|
139
139
|
end
|
@@ -143,7 +143,7 @@ describe MustBe do
|
|
143
143
|
it "should not notify if any exception is raised" do
|
144
144
|
expect do
|
145
145
|
:it.must_raise(nil) { raise Exception }
|
146
|
-
end.
|
146
|
+
end.to raise_error(Exception)
|
147
147
|
should_not notify
|
148
148
|
end
|
149
149
|
|
@@ -158,7 +158,7 @@ describe MustBe do
|
|
158
158
|
" the same message is raised" do
|
159
159
|
expect do
|
160
160
|
:it.must_raise(TypeError, "oops") { raise TypeError, "oops" }
|
161
|
-
end.
|
161
|
+
end.to raise_error(TypeError)
|
162
162
|
should_not notify
|
163
163
|
end
|
164
164
|
|
@@ -171,7 +171,7 @@ describe MustBe do
|
|
171
171
|
it "should notify if an exception of a different type is raised" do
|
172
172
|
expect do
|
173
173
|
:it.must_raise(TypeError, "oops") { raise ArgumentError, "wrong" }
|
174
|
-
end.
|
174
|
+
end.to raise_error(ArgumentError)
|
175
175
|
should notify(":it.must_raise(TypeError, \"oops\") {},"\
|
176
176
|
" but ArgumentError was raised")
|
177
177
|
end
|
@@ -180,7 +180,7 @@ describe MustBe do
|
|
180
180
|
" but with a different message is raised" do
|
181
181
|
expect do
|
182
182
|
:it.must_raise(TypeError, "oops") { raise TypeError, "wrong" }
|
183
|
-
end.
|
183
|
+
end.to raise_error(TypeError)
|
184
184
|
should notify(":it.must_raise(TypeError, \"oops\") {},"\
|
185
185
|
" but TypeError with message \"wrong\" was raised")
|
186
186
|
end
|
@@ -191,7 +191,7 @@ describe MustBe do
|
|
191
191
|
" matching message is raised" do
|
192
192
|
expect do
|
193
193
|
:it.must_raise(TypeError, /oops/) { raise TypeError, "oops" }
|
194
|
-
end.
|
194
|
+
end.to raise_error(TypeError)
|
195
195
|
should_not notify
|
196
196
|
end
|
197
197
|
|
@@ -204,7 +204,7 @@ describe MustBe do
|
|
204
204
|
it "should notify if an exception of a different type is raised" do
|
205
205
|
expect do
|
206
206
|
:it.must_raise(TypeError, /oops/) { raise ArgumentError, "wrong" }
|
207
|
-
end.
|
207
|
+
end.to raise_error(ArgumentError)
|
208
208
|
should notify(":it.must_raise(TypeError, /oops/) {},"\
|
209
209
|
" but ArgumentError was raised")
|
210
210
|
end
|
@@ -213,7 +213,7 @@ describe MustBe do
|
|
213
213
|
" but with a non-matching message is raised" do
|
214
214
|
expect do
|
215
215
|
:it.must_raise(TypeError, /oops/) { raise TypeError, "wrong" }
|
216
|
-
end.
|
216
|
+
end.to raise_error(TypeError)
|
217
217
|
should notify(":it.must_raise(TypeError, /oops/) {},"\
|
218
218
|
" but TypeError with message \"wrong\" was raised")
|
219
219
|
end
|
@@ -223,7 +223,7 @@ describe MustBe do
|
|
223
223
|
it "should not notify if an exception of the same type is raised" do
|
224
224
|
expect do
|
225
225
|
:it.must_raise(TypeError, nil) { raise TypeError }
|
226
|
-
end.
|
226
|
+
end.to raise_error(TypeError)
|
227
227
|
should_not notify
|
228
228
|
end
|
229
229
|
|
@@ -236,7 +236,7 @@ describe MustBe do
|
|
236
236
|
it "should notify if a different exception type is raised" do
|
237
237
|
expect do
|
238
238
|
:it.must_raise(TypeError, nil) { raise ArgumentError }
|
239
|
-
end.
|
239
|
+
end.to raise_error(ArgumentError)
|
240
240
|
should notify(":it.must_raise(TypeError, nil) {},"\
|
241
241
|
" but ArgumentError was raised")
|
242
242
|
end
|
@@ -248,7 +248,7 @@ describe MustBe do
|
|
248
248
|
it "should just yield" do
|
249
249
|
did_yield = false
|
250
250
|
:it.must_raise { did_yield = true }
|
251
|
-
did_yield.should
|
251
|
+
did_yield.should be true
|
252
252
|
end
|
253
253
|
end
|
254
254
|
end
|
@@ -261,14 +261,14 @@ describe MustBe do
|
|
261
261
|
it "should notify if any exception is raised" do
|
262
262
|
expect do
|
263
263
|
:it.must_not_raise { raise Exception }
|
264
|
-
end.
|
264
|
+
end.to raise_error(Exception)
|
265
265
|
should notify(":it.must_not_raise {}, but raised Exception")
|
266
266
|
end
|
267
267
|
|
268
268
|
it "should not notify if no exception is raised" do
|
269
269
|
called = false
|
270
270
|
:it.must_not_raise {called = true; :result}.should == :result
|
271
|
-
called.should
|
271
|
+
called.should be true
|
272
272
|
should_not notify
|
273
273
|
end
|
274
274
|
end
|
@@ -277,7 +277,7 @@ describe MustBe do
|
|
277
277
|
it "should notify if an exception of the same type is raised" do
|
278
278
|
expect do
|
279
279
|
:it.must_not_raise(TypeError) { raise TypeError }
|
280
|
-
end.
|
280
|
+
end.to raise_error(TypeError)
|
281
281
|
should notify(":it.must_not_raise(TypeError) {},"\
|
282
282
|
" but raised TypeError")
|
283
283
|
end
|
@@ -290,7 +290,7 @@ describe MustBe do
|
|
290
290
|
it "should not notify if a different exception type is raised" do
|
291
291
|
expect do
|
292
292
|
:it.must_not_raise(TypeError) { raise ArgumentError }
|
293
|
-
end.
|
293
|
+
end.to raise_error(ArgumentError)
|
294
294
|
should_not notify
|
295
295
|
end
|
296
296
|
end
|
@@ -299,7 +299,7 @@ describe MustBe do
|
|
299
299
|
it "should notify if an exception with the same message is raised" do
|
300
300
|
expect do
|
301
301
|
:it.must_not_raise("message") { raise "message" }
|
302
|
-
end.
|
302
|
+
end.to raise_error(RuntimeError)
|
303
303
|
should notify(":it.must_not_raise(\"message\") {},"\
|
304
304
|
" but raised RuntimeError with message \"message\"")
|
305
305
|
end
|
@@ -313,7 +313,7 @@ describe MustBe do
|
|
313
313
|
" raised" do
|
314
314
|
expect do
|
315
315
|
:it.must_not_raise("message") { raise "wrong" }
|
316
|
-
end.
|
316
|
+
end.to raise_error(RuntimeError)
|
317
317
|
should_not notify
|
318
318
|
end
|
319
319
|
end
|
@@ -322,7 +322,7 @@ describe MustBe do
|
|
322
322
|
it "should notify if an exception with matching message is raised" do
|
323
323
|
expect do
|
324
324
|
:it.must_not_raise(/message/) { raise "some message" }
|
325
|
-
end.
|
325
|
+
end.to raise_error(RuntimeError)
|
326
326
|
should notify(":it.must_not_raise(/message/) {},"\
|
327
327
|
" but raised RuntimeError with message \"some message\"")
|
328
328
|
end
|
@@ -336,7 +336,7 @@ describe MustBe do
|
|
336
336
|
" is raised" do
|
337
337
|
expect do
|
338
338
|
:it.must_not_raise(/message/) { raise "mess" }
|
339
|
-
end.
|
339
|
+
end.to raise_error(RuntimeError)
|
340
340
|
should_not notify
|
341
341
|
end
|
342
342
|
end
|
@@ -345,7 +345,7 @@ describe MustBe do
|
|
345
345
|
it "should notify if any exception is raised" do
|
346
346
|
expect do
|
347
347
|
:it.must_not_raise(nil) { raise Exception }
|
348
|
-
end.
|
348
|
+
end.to raise_error(Exception)
|
349
349
|
should notify(":it.must_not_raise(nil) {}, but raised Exception")
|
350
350
|
end
|
351
351
|
|
@@ -360,7 +360,7 @@ describe MustBe do
|
|
360
360
|
" the same message is raised" do
|
361
361
|
expect do
|
362
362
|
:it.must_not_raise(TypeError, "oops") { raise TypeError, "oops" }
|
363
|
-
end.
|
363
|
+
end.to raise_error(TypeError)
|
364
364
|
should notify(":it.must_not_raise(TypeError, \"oops\") {},"\
|
365
365
|
" but raised TypeError with message \"oops\"")
|
366
366
|
end
|
@@ -373,7 +373,7 @@ describe MustBe do
|
|
373
373
|
it "should not notify if an exception of a different type is raised" do
|
374
374
|
expect do
|
375
375
|
:it.must_not_raise(TypeError, "oops") { raise ArgumentError, "grr" }
|
376
|
-
end.
|
376
|
+
end.to raise_error(ArgumentError)
|
377
377
|
should_not notify
|
378
378
|
end
|
379
379
|
|
@@ -381,7 +381,7 @@ describe MustBe do
|
|
381
381
|
" but with a different message is raised" do
|
382
382
|
expect do
|
383
383
|
:it.must_not_raise(TypeError, "oops") { raise TypeError, "wrong" }
|
384
|
-
end.
|
384
|
+
end.to raise_error(TypeError)
|
385
385
|
should_not notify
|
386
386
|
end
|
387
387
|
end
|
@@ -391,7 +391,7 @@ describe MustBe do
|
|
391
391
|
" matching message is raised" do
|
392
392
|
expect do
|
393
393
|
:it.must_not_raise(TypeError, /oops/) { raise TypeError, "oops" }
|
394
|
-
end.
|
394
|
+
end.to raise_error(TypeError)
|
395
395
|
should notify(":it.must_not_raise(TypeError, /oops/) {},"\
|
396
396
|
" but raised TypeError with message \"oops\"")
|
397
397
|
end
|
@@ -404,7 +404,7 @@ describe MustBe do
|
|
404
404
|
it "should not notify if an exception of a different type is raised" do
|
405
405
|
expect do
|
406
406
|
:it.must_not_raise(TypeError, /oops/) { raise ArgumentError, "grr" }
|
407
|
-
end.
|
407
|
+
end.to raise_error(ArgumentError)
|
408
408
|
should_not notify
|
409
409
|
end
|
410
410
|
|
@@ -412,7 +412,7 @@ describe MustBe do
|
|
412
412
|
" but with a non-matching message is raised" do
|
413
413
|
expect do
|
414
414
|
:it.must_not_raise(TypeError, /oops/) { raise TypeError, "wrong" }
|
415
|
-
end.
|
415
|
+
end.to raise_error(TypeError)
|
416
416
|
should_not notify
|
417
417
|
end
|
418
418
|
end
|
@@ -421,7 +421,7 @@ describe MustBe do
|
|
421
421
|
it "should notify if an exception of the same type is raised" do
|
422
422
|
expect do
|
423
423
|
:it.must_not_raise(TypeError, nil) { raise TypeError }
|
424
|
-
end.
|
424
|
+
end.to raise_error(TypeError)
|
425
425
|
should notify(":it.must_not_raise(TypeError, nil) {},"\
|
426
426
|
" but raised TypeError")
|
427
427
|
end
|
@@ -434,7 +434,7 @@ describe MustBe do
|
|
434
434
|
it "should not notify if a different exception type is raised" do
|
435
435
|
expect do
|
436
436
|
:it.must_not_raise(TypeError, nil) { raise ArgumentError }
|
437
|
-
end.
|
437
|
+
end.to raise_error(ArgumentError)
|
438
438
|
should_not notify
|
439
439
|
end
|
440
440
|
end
|
@@ -445,7 +445,7 @@ describe MustBe do
|
|
445
445
|
it "should raise ArgumentError" do
|
446
446
|
expect do
|
447
447
|
:it.send(the_method_name, :symbol, :object, :other) {}
|
448
|
-
end.
|
448
|
+
end.to raise_error(ArgumentError,
|
449
449
|
"wrong number of arguments (3 for 2)")
|
450
450
|
end
|
451
451
|
end
|
@@ -466,7 +466,7 @@ describe MustBe do
|
|
466
466
|
it "should notify and reraise" do
|
467
467
|
expect do
|
468
468
|
:it.must_throw { raise }
|
469
|
-
end.
|
469
|
+
end.to raise_error(RuntimeError, "")
|
470
470
|
should notify(":it.must_throw {}, but raised RuntimeError")
|
471
471
|
end
|
472
472
|
|
@@ -483,7 +483,7 @@ describe MustBe do
|
|
483
483
|
it "should raise without transparently" do
|
484
484
|
expect do
|
485
485
|
:it.must_throw { raise }
|
486
|
-
end.
|
486
|
+
end.to raise_error(Note,
|
487
487
|
":it.must_throw {}, but raised RuntimeError")
|
488
488
|
end
|
489
489
|
|
@@ -492,7 +492,7 @@ describe MustBe do
|
|
492
492
|
MustBe.send(:class_variable_set, :@@must_throw__installed, false)
|
493
493
|
expect do
|
494
494
|
:it.must_throw { throw :ball }
|
495
|
-
end.
|
495
|
+
end.to raise_error(Note, /:it.must_throw \{\}, but raised/)
|
496
496
|
end
|
497
497
|
end
|
498
498
|
end
|
@@ -501,11 +501,13 @@ describe MustBe do
|
|
501
501
|
it "should notify and reraise" do
|
502
502
|
expect do
|
503
503
|
:it.must_throw { throw :uncaught }
|
504
|
-
end.
|
504
|
+
end.to raise_error(/uncaught throw/)
|
505
505
|
if RUBY_VERSION < "1.9"
|
506
506
|
should notify(":it.must_throw {}, but raised NameError")
|
507
|
-
|
507
|
+
elsif RUBY_VERSION < "2.4"
|
508
508
|
should notify(":it.must_throw {}, but raised ArgumentError")
|
509
|
+
else
|
510
|
+
should notify(":it.must_throw {}, but raised UncaughtThrowError")
|
509
511
|
end
|
510
512
|
end
|
511
513
|
end
|
@@ -515,7 +517,7 @@ describe MustBe do
|
|
515
517
|
it "should not notify" do
|
516
518
|
expect do
|
517
519
|
:it.must_throw { throw :ball }
|
518
|
-
end.
|
520
|
+
end.to throw_symbol(:ball)
|
519
521
|
should_not notify
|
520
522
|
end
|
521
523
|
end
|
@@ -524,14 +526,14 @@ describe MustBe do
|
|
524
526
|
it "should not notify if tag equals thrown tag" do
|
525
527
|
expect do
|
526
528
|
:it.must_throw(:ball) { throw :ball }
|
527
|
-
end.
|
529
|
+
end.to throw_symbol(:ball)
|
528
530
|
should_not notify
|
529
531
|
end
|
530
532
|
|
531
533
|
it "should notify if tag does not equal thrown tag" do
|
532
534
|
expect do
|
533
535
|
:it.must_throw(:pie) { throw :ball }
|
534
|
-
end.
|
536
|
+
end.to throw_symbol(:ball)
|
535
537
|
should notify(":it.must_throw(:pie) {}, but threw :ball")
|
536
538
|
end
|
537
539
|
|
@@ -539,7 +541,7 @@ describe MustBe do
|
|
539
541
|
it "should notify" do
|
540
542
|
expect do
|
541
543
|
:it.must_throw(:ball, :fiercely) { throw :ball }
|
542
|
-
end.
|
544
|
+
end.to throw_symbol(:ball)
|
543
545
|
should notify(":it.must_throw(:ball, :fiercely) {},"\
|
544
546
|
" but threw :ball")
|
545
547
|
end
|
@@ -547,7 +549,7 @@ describe MustBe do
|
|
547
549
|
it "should notify even if checked object is nil" do
|
548
550
|
expect do
|
549
551
|
:it.must_throw(:ball, nil) { throw :ball }
|
550
|
-
end.
|
552
|
+
end.to throw_symbol(:ball)
|
551
553
|
should notify(":it.must_throw(:ball, nil) {},"\
|
552
554
|
" but threw :ball")
|
553
555
|
end
|
@@ -559,14 +561,14 @@ describe MustBe do
|
|
559
561
|
" object equals thrown object" do
|
560
562
|
expect do
|
561
563
|
:it.must_throw(:ball, :gently) { throw :ball, :gently }
|
562
|
-
end.
|
564
|
+
end.to throw_symbol(:ball, :gently)
|
563
565
|
should_not notify
|
564
566
|
end
|
565
567
|
|
566
568
|
it "should notify if tag does not equal thrown tag" do
|
567
569
|
expect do
|
568
570
|
:it.must_throw(:pie, :gently) { throw :ball, :gently }
|
569
|
-
end.
|
571
|
+
end.to throw_symbol(:ball, :gently)
|
570
572
|
should notify(":it.must_throw(:pie, :gently) {},"\
|
571
573
|
" but threw :ball, :gently")
|
572
574
|
end
|
@@ -574,7 +576,7 @@ describe MustBe do
|
|
574
576
|
it "should notify if object does not equal thrown object" do
|
575
577
|
expect do
|
576
578
|
:it.must_throw(:ball, :fiercely) { throw :ball, :gently }
|
577
|
-
end.
|
579
|
+
end.to throw_symbol(:ball, :gently)
|
578
580
|
should notify(":it.must_throw(:ball, :fiercely) {},"\
|
579
581
|
" but threw :ball, :gently")
|
580
582
|
end
|
@@ -583,14 +585,14 @@ describe MustBe do
|
|
583
585
|
it "should not notify if thrown object is nil" do
|
584
586
|
expect do
|
585
587
|
:it.must_throw(:ball, nil) { throw :ball, nil }
|
586
|
-
end.
|
588
|
+
end.to throw_symbol(:ball)
|
587
589
|
should_not notify
|
588
590
|
end
|
589
591
|
|
590
592
|
it "should notify if thrown object is not nil" do
|
591
593
|
expect do
|
592
594
|
:it.must_throw(:ball, nil) { throw :ball, :gently }
|
593
|
-
end.
|
595
|
+
end.to throw_symbol(:ball)
|
594
596
|
should notify(":it.must_throw(:ball, nil) {},"\
|
595
597
|
" but threw :ball, :gently")
|
596
598
|
end
|
@@ -604,7 +606,7 @@ describe MustBe do
|
|
604
606
|
it "should just yield" do
|
605
607
|
did_yield = false
|
606
608
|
:it.must_throw { did_yield = true }
|
607
|
-
did_yield.should
|
609
|
+
did_yield.should be true
|
608
610
|
end
|
609
611
|
end
|
610
612
|
|
@@ -643,7 +645,7 @@ describe MustBe do
|
|
643
645
|
$note = nil
|
644
646
|
end
|
645
647
|
end
|
646
|
-
end.
|
648
|
+
end.to throw_symbol(:ball)
|
647
649
|
note.message.should == ":it.must_throw(:ball, :fiercely) {},"\
|
648
650
|
" but threw :ball, :gently"
|
649
651
|
outer_note.message.should == ":it.must_throw(:party) {},"\
|
@@ -699,7 +701,7 @@ describe MustBe do
|
|
699
701
|
end
|
700
702
|
fiber.resume
|
701
703
|
|
702
|
-
got_to_end.should
|
704
|
+
got_to_end.should be true
|
703
705
|
should notify(":it.must_throw {}, but did not throw")
|
704
706
|
end
|
705
707
|
end
|
@@ -721,7 +723,7 @@ describe MustBe do
|
|
721
723
|
it "should not notify and should reraise" do
|
722
724
|
expect do
|
723
725
|
:it.must_not_throw { throw :uncaught }
|
724
|
-
end.
|
726
|
+
end.to raise_error(/uncaught throw/)
|
725
727
|
should_not notify
|
726
728
|
end
|
727
729
|
end
|
@@ -731,7 +733,7 @@ describe MustBe do
|
|
731
733
|
it "should notify" do
|
732
734
|
expect do
|
733
735
|
:it.must_not_throw { throw :ball }
|
734
|
-
end.
|
736
|
+
end.to throw_symbol(:ball)
|
735
737
|
should notify(":it.must_not_throw {}, but threw :ball")
|
736
738
|
end
|
737
739
|
end
|
@@ -740,14 +742,14 @@ describe MustBe do
|
|
740
742
|
it "should notify if tag equals thrown tag" do
|
741
743
|
expect do
|
742
744
|
:it.must_not_throw(:ball) { throw :ball }
|
743
|
-
end.
|
745
|
+
end.to throw_symbol(:ball)
|
744
746
|
should notify(":it.must_not_throw(:ball) {}, but threw :ball")
|
745
747
|
end
|
746
748
|
|
747
749
|
it "should not notify if tag does not equal thrown tag" do
|
748
750
|
expect do
|
749
751
|
:it.must_not_throw(:pie) { throw :ball }
|
750
|
-
end.
|
752
|
+
end.to throw_symbol(:ball)
|
751
753
|
should_not notify
|
752
754
|
end
|
753
755
|
|
@@ -755,7 +757,7 @@ describe MustBe do
|
|
755
757
|
it "should not notify" do
|
756
758
|
expect do
|
757
759
|
:it.must_not_throw(:ball, :fiercely) { throw :ball }
|
758
|
-
end.
|
760
|
+
end.to throw_symbol(:ball)
|
759
761
|
should_not notify(":it.must_not_throw(:ball, :fiercely) {},"\
|
760
762
|
" but threw :ball")
|
761
763
|
end
|
@@ -763,7 +765,7 @@ describe MustBe do
|
|
763
765
|
it "should not notify even if checked object is nil" do
|
764
766
|
expect do
|
765
767
|
:it.must_not_throw(:ball, nil) { throw :ball }
|
766
|
-
end.
|
768
|
+
end.to throw_symbol(:ball)
|
767
769
|
should_not notify
|
768
770
|
end
|
769
771
|
end
|
@@ -774,7 +776,7 @@ describe MustBe do
|
|
774
776
|
" object equals thrown object" do
|
775
777
|
expect do
|
776
778
|
:it.must_not_throw(:ball, :gently) { throw :ball, :gently }
|
777
|
-
end.
|
779
|
+
end.to throw_symbol(:ball, :gently)
|
778
780
|
should notify(":it.must_not_throw(:ball, :gently) {},"\
|
779
781
|
" but threw :ball, :gently")
|
780
782
|
end
|
@@ -782,14 +784,14 @@ describe MustBe do
|
|
782
784
|
it "should not notify if tag does not equal thrown tag" do
|
783
785
|
expect do
|
784
786
|
:it.must_not_throw(:pie, :gently) { throw :ball, :gently }
|
785
|
-
end.
|
787
|
+
end.to throw_symbol(:ball, :gently)
|
786
788
|
should_not notify
|
787
789
|
end
|
788
790
|
|
789
791
|
it "should not notify if object does not equal thrown object" do
|
790
792
|
expect do
|
791
793
|
:it.must_not_throw(:ball, :fiercely) { throw :ball, :gently }
|
792
|
-
end.
|
794
|
+
end.to throw_symbol(:ball, :gently)
|
793
795
|
should_not notify
|
794
796
|
end
|
795
797
|
|
@@ -797,7 +799,7 @@ describe MustBe do
|
|
797
799
|
it "should notify if thrown object is nil" do
|
798
800
|
expect do
|
799
801
|
:it.must_not_throw(:ball, nil) { throw :ball, nil }
|
800
|
-
end.
|
802
|
+
end.to throw_symbol(:ball)
|
801
803
|
should notify(":it.must_not_throw(:ball, nil) {},"\
|
802
804
|
" but threw :ball, nil")
|
803
805
|
end
|
@@ -805,7 +807,7 @@ describe MustBe do
|
|
805
807
|
it "should not notify if thrown object is not nil" do
|
806
808
|
expect do
|
807
809
|
:it.must_not_throw(:ball, nil) { throw :ball, :gently }
|
808
|
-
end.
|
810
|
+
end.to throw_symbol(:ball)
|
809
811
|
should_not notify
|
810
812
|
end
|
811
813
|
end
|
@@ -834,7 +836,7 @@ describe MustBe do
|
|
834
836
|
$note = nil
|
835
837
|
end
|
836
838
|
end
|
837
|
-
end.
|
839
|
+
end.to throw_symbol(:ball)
|
838
840
|
note.message.should == ":it.must_not_throw(:ball, :gently) {},"\
|
839
841
|
" but threw :ball, :gently"
|
840
842
|
outer_note.should == nil
|