rubyunit 0.2.14 → 0.3.15

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -5
  3. data/TestSuite.rb +7 -23
  4. data/lib/RubyUnit/AssertionFailure.rb +9 -9
  5. data/lib/RubyUnit/AssertionMessage.rb +70 -0
  6. data/lib/RubyUnit/Assertions/Basic.rb +121 -0
  7. data/lib/RubyUnit/Assertions/Class.rb +196 -0
  8. data/lib/RubyUnit/Assertions/Collection.rb +80 -0
  9. data/lib/RubyUnit/Assertions/Comparison.rb +200 -0
  10. data/lib/RubyUnit/Assertions/Exception.rb +105 -0
  11. data/lib/RubyUnit/Assertions/Method.rb +157 -0
  12. data/lib/RubyUnit/Assertions.rb +9 -636
  13. data/lib/RubyUnit/Runner.rb +1 -2
  14. data/lib/RubyUnit.rb +28 -4
  15. data/tests/AssertionFailure/TC_Class.rb +2 -13
  16. data/tests/AssertionFailure/TC_Instance.rb +1 -1
  17. data/tests/AssertionFailure/data/Instance.rb +3 -3
  18. data/tests/AssertionMessage/TC_Constant.rb +20 -0
  19. data/tests/AssertionMessage/data/Constant.rb +70 -0
  20. data/tests/Assertions/TC_Basic.rb +349 -0
  21. data/tests/Assertions/TC_Class.rb +75 -0
  22. data/tests/Assertions/TC_Comparison.rb +13 -0
  23. data/tests/Assertions/data/Basic.rb +90 -0
  24. data/tests/Assertions/data/Class.rb +54 -0
  25. data/tests/Assertions/data/Comparison.rb +7 -0
  26. data/tests/Assertions/data/ObjectTypes.rb +174 -0
  27. data/tests/IncompleteTest/TC_IncompleteTest.rb +15 -0
  28. data/tests/RubyUnit/TC_RubyUnit.rb +30 -0
  29. data/tests/RubyUnit/data/RubyUnit.rb +16 -0
  30. data/tests/Runner/TC_Runner.rb +9 -0
  31. data/tests/SkippedTest/TC_SkippedTest.rb +15 -0
  32. data/tests/TS_AssertionFailure.rb +4 -2
  33. data/tests/TS_AssertionMessage.rb +9 -0
  34. data/tests/TS_Assertions.rb +67 -0
  35. data/tests/TS_IncompleteTest.rb +9 -0
  36. data/tests/TS_RubyUnit.rb +4 -2
  37. data/tests/TS_Runner.rb +9 -0
  38. data/tests/TS_SkippedTest.rb +9 -0
  39. data/tests/TS_TestCase.rb +9 -0
  40. data/tests/TestCase/TC_TestCase.rb +120 -0
  41. data/tests/TestCase/data/TestCase.rb +24 -0
  42. metadata +32 -12
  43. data/tests/AssertionFailure/data/Class.rb +0 -12
  44. data/tests/TEST_Assertions.rb +0 -37
  45. data/tests/TEST_IncompleteTest.rb +0 -13
  46. data/tests/TEST_Runner.rb +0 -7
  47. data/tests/TEST_SkippedTest.rb +0 -13
  48. data/tests/TEST_TestCase.rb +0 -122
  49. data/tests/data/Assertions.rb +0 -23
  50. data/tests/data/TestCase.rb +0 -22
  51. data/tests/fixture/TestCase.rb +0 -6
@@ -3,645 +3,11 @@ module RubyUnit
3
3
  # Assertions that can be used by RubyUnit::TestCase
4
4
  #
5
5
  module Assertions
6
+ include AssertionMessage
7
+
6
8
  # Tracks the total number of assertions made during the tests
7
9
  @@assertions = 0
8
10
 
9
- #
10
- # Fail the test. This is used when some conditioned outside the test warrants
11
- # a test failure.
12
- # * This is likely an indication of something unexpected or missing functionality
13
- # * raises RubyUnit::AssertionFailure
14
- #
15
- # message::
16
- # The message provided to be reported for a failure
17
- #
18
- # data::
19
- # The data associated with assertion
20
- #
21
- # fail "I wasn't expecting the moon to fall into Lake Michigan" # => fail
22
- #
23
- def fail message = nil, data = {}
24
- build_message AssertionFailure::FAILING, message, data
25
- end
26
-
27
- #
28
- # Assert that a test condition is true.
29
- # * raises RubyUnit::AssertionFailure if _value_ is false or nil
30
- #
31
- # value::
32
- # The value that is being checked by the assertion
33
- #
34
- # message::
35
- # The message provided to be reported for a failure
36
- #
37
- # assert false, "This will fail" # => fail
38
- #
39
- def assert value, message = nil
40
- __assert value, 'Failed to assert that value is not false or nil', message, {:value=>value}
41
- end
42
-
43
- #
44
- # Assert that a test condition is false.
45
- # * raises RubyUnit::AssertionFailure unless _value_ is false or nil
46
- #
47
- # value::
48
- # The value that is being checked by the assertion
49
- #
50
- # message::
51
- # The message provided to be reported for a failure
52
- #
53
- # assertNot true, "This will fail" # => fail
54
- #
55
- def assertNot value, message = nil
56
- __reject value, 'Value should NOT be false or nil', message, {:value=>value}
57
- end
58
-
59
- #
60
- # Assert that a test condition is exactly true.
61
- # * raises RubyUnit::AssertionFailure unless _value_ is true
62
- #
63
- # value::
64
- # The value that is being checked by the assertion
65
- #
66
- # message::
67
- # The message provided to be reported for a failure
68
- #
69
- # assertTrue false, "This will fail" # => fail
70
- #
71
- def assertTrue value, message = nil
72
- __assert (true == value), 'Failed to assert that value is EXACTLY true', message, {:value=>value}
73
- end
74
-
75
- #
76
- # Assert that a test condition is exactly false.
77
- # * raises RubyUnit::AssertionFailure unless _value_ is false
78
- #
79
- # value::
80
- # The value that is being checked by the assertion
81
- #
82
- # message::
83
- # The message provided to be reported for a failure
84
- #
85
- # assertNil true, "This will fail" # => fail
86
- #
87
- def assertFalse value, message = nil
88
- __assert (false == value), 'Failed to assert that value is EXACTLY false', message, {:value=>value}
89
- end
90
-
91
- #
92
- # Assert that a test condition is exactly nil.
93
- # * raises RubyUnit::AssertionFailure unless _value_ is nil
94
- #
95
- # value::
96
- # The value that is being checked by the assertion
97
- #
98
- # message::
99
- # The message provided to be reported for a failure
100
- #
101
- # assertNil true, "This will fail" # => fail
102
- #
103
- def assertNil value, message = nil
104
- __assert value.nil?, 'Failed to assert that value is EXACTLY nil', message, {:value=>value}
105
- end
106
-
107
- #
108
- # Assert that a test condition is not nil.
109
- # * raises RubyUnit::AssertionFailure if _value_ is nil
110
- #
111
- # value::
112
- # The value that is being checked by the assertion
113
- #
114
- # message::
115
- # The message provided to be reported for a failure
116
- #
117
- # assertNotNil nil, "This will fail" # => fail
118
- #
119
- def assertNotNil value, message = nil
120
- __reject value.nil?, 'Failed to assert that value is NOT nil', message, {:value=>value}
121
- end
122
-
123
- #
124
- # Assert that a value is empty
125
- # * raises RubyUnit::AssertionFailure unless _object_ responds to :empty?
126
- # * raises RubyUnit::AssertionFailure unless _object_ is empty
127
- #
128
- # object::
129
- # The object to check
130
- #
131
- # message::
132
- # The message provided to be reported for a failure
133
- #
134
- # assertEmpty [1, 2], 'Not empty' # => fail
135
- #
136
- def assertEmpty object, message = nil
137
- assertRespondTo object, :include?, message
138
- __assert object.empty?, 'Failed to assert object is empty', message, {:object=>object}
139
- end
140
-
141
- #
142
- # Assert that a value is not empty
143
- # * raises RubyUnit::AssertionFailure unless _object_ responds to :empty?
144
- # * raises RubyUnit::AssertionFailure if _object_ is empty
145
- #
146
- # object::
147
- # The object to check
148
- #
149
- # message::
150
- # The message provided to be reported for a failure
151
- #
152
- # assertNotInclude [1, 2, 3], 2, 'It does, so close' # => fail
153
- #
154
- def assertNotEmpty object, message = nil
155
- assertRespondTo object, :include?, message
156
- __reject object.empty?, 'Failed to assert object is NOT empty', message, {:object=>object}
157
- end
158
-
159
- #
160
- # Assert that two values are equal.
161
- # * raises RubyUnit::AssertionFailure unless _expected_ equals _actual_
162
- #
163
- # expected::
164
- # The value that is forbidden by the assertion
165
- #
166
- # actual::
167
- # The value that is being checked by the assertion
168
- #
169
- # message::
170
- # The message provided to be reported for a failure
171
- #
172
- # assertEqual 42, 24, "This will fail" # => fail
173
- #
174
- def assertEqual expected, actual, message = nil
175
- __assert (expected == actual), 'Failed to assert that values are equal', message, {:expected=>expected, :actual=>actual}
176
- end
177
-
178
- #
179
- # Assert that two values are NOT equal.
180
- # * raises RubyUnit::AssertionFailure if _illegal_ equals _actual_
181
- #
182
- # illegal::
183
- # The value that is not allowed by the assertion
184
- #
185
- # actual::
186
- # The value that is being checked by the assertion
187
- #
188
- # message::
189
- # The message provided to be reported for a failure
190
- #
191
- # assertNotEqual 3.14, 3.14, "This will fail" # => fail
192
- #
193
- def assertNotEqual illegal, actual, message = nil
194
- __reject (illegal == actual), 'Values should NOT be equal', message, {:illegal=>illegal, :actual=>actual}
195
- end
196
-
197
- #
198
- # Assert that a value matches a Regexp pattern.
199
- # * raises RubyUnit::AssertionFailure unless _value_ matches _pattern_
200
- #
201
- # pattern::
202
- # A Regexp pattern expected by the assertion
203
- #
204
- # value::
205
- # The value that is being checked for the assertion
206
- #
207
- # message::
208
- # The message provided to be reported for a failure
209
- #
210
- # assertMatch /^Hello/, 'Goodbye!', "This will fail" # => fail
211
- #
212
- def assertMatch pattern, value, message = nil
213
- __assert (value =~ pattern), 'Failed to assert value matches pattern', message, {:pattern=>pattern, :value=>value}
214
- end
215
-
216
- #
217
- # Assert that a value does not match a Regexp pattern.
218
- # * raises RubyUnit::AssertionFailure if _value_ matches _pattern_
219
- #
220
- # pattern::
221
- # A Regexp pattern excluded by the assertion
222
- #
223
- # value::
224
- # The value that is being checked for the assertion
225
- #
226
- # message::
227
- # The message provided to be reported for a failure
228
- #
229
- # assertMatch /^Good/, 'Goodbye!', "This will fail" # => fail
230
- #
231
- def assertNotMatch exclusion, value, message = nil
232
- __reject (value =~ exclusion), 'Value should NOT match exclusion', message, {:exclusion=>exclusion, :value=>value}
233
- end
234
-
235
- #
236
- # Assert that two objects are the same object
237
- # * raises RubyUnit::AssertionFailure unless _expected_ and _actual_ are
238
- # the same object.
239
- #
240
- # expected::
241
- # The expected object
242
- #
243
- # actual::
244
- # The object that is being checked against _expected_
245
- #
246
- # message::
247
- # The message provided to be reported for a failure
248
- #
249
- # assertSame '42', 42, 'Not even close.' # => fail
250
- #
251
- def assertSame expected, actual, message = nil
252
- __assert (expected.equal? actual), 'Failed to assert objects are the same', message, {:expected=>expected, :actual=>actual}
253
- end
254
-
255
- #
256
- # Assert that two objects are not the same object
257
- # * raises RubyUnit::AssertionFailure if _illegal_ and _actual_ are the
258
- # same object.
259
- #
260
- # illegal::
261
- # The expected that it shouldn't be
262
- #
263
- # actual::
264
- # The object that is being checked against _illegal_
265
- #
266
- # message::
267
- # The message provided to be reported for a failure
268
- #
269
- # assertNotSame value, value, 'Imagine that!' # => fail
270
- #
271
- def assertNotSame illegal, actual, message = nil
272
- __reject (illegal.equal? actual), 'Objects shoul NOT be the same', message, {:illegal=>illegal, :actual=>actual}
273
- end
274
-
275
- #
276
- # Assert that an object is an instance of the specified class or one of
277
- # its descendents.
278
- # * raises RubyUnit::AssertionFailure unless _object_ is an instance of
279
- # _klass_ or one of its descendents.
280
- #
281
- # klass::
282
- # The class that is expected
283
- #
284
- # object::
285
- # The object that will be checked against _klass_
286
- #
287
- # message::
288
- # The message provided to be reported for a failure
289
- #
290
- # assertKindOf String, 25, 'Nope, try again.' # => fail
291
- #
292
- def assertKindOf klass, object, message = nil
293
- __assert (object.is_a? klass), 'Failed to assert object heritage', message, {:klass=>klass, :object=>object}
294
- end
295
-
296
- alias_method :assertIsA, :assertKindOf
297
-
298
- #
299
- # Assert that an object is not an instance of the specified class or one of
300
- # its descendents.
301
- # * raises RubyUnit::AssertionFailure if _object_ is an instance of _exclusion_ or
302
- # one of its descendents.
303
- #
304
- # exclusion::
305
- # The class that is excluded
306
- #
307
- # object::
308
- # The object that will be checked against _klass_
309
- #
310
- # message::
311
- # The message provided to be reported for a failure
312
- #
313
- # assertNotKindOf Numeric, 25, 'Nope, try again.' # => fail
314
- #
315
- def assertNotKindOf exclusion, object, message = nil
316
- __reject (object.is_a? exclusion), 'Object should NOT be a descendent', message, {:exclusion=>exclusion, :object=>object}
317
- end
318
-
319
- [:assertNotIsA, :assertIsNotA].each do |method|
320
- alias_method method, :assertNotKindOf
321
- end
322
-
323
- #
324
- # Assert that an object is an instance of a specified class
325
- # * raises RubyUnit::AssertionFailure unless _object_ is an instance of _klass_.
326
- #
327
- # klass::
328
- # The class that is expected
329
- #
330
- # object::
331
- # The object that will be checked against _klass_
332
- #
333
- # message::
334
- # The message provided to be reported for a failure
335
- #
336
- # assertInstanceOf Integer, '25', 'So close, but... No.' # => fail
337
- #
338
- def assertInstanceOf klass, object, message = nil
339
- __assert (object.instance_of? klass), 'Failed to assert object instance', message, {:klass=>klass, :object=>object}
340
- end
341
-
342
- #
343
- # Assert that an object is an instance of a specified class
344
- # * raises RubyUnit::AssertionFailure unless _object_ is an instance of _klass_.
345
- #
346
- # exclusion::
347
- # The class that is expected
348
- #
349
- # object::
350
- # The object that will be checked against _klass_
351
- #
352
- # message::
353
- # The message provided to be reported for a failure
354
- #
355
- # assertNotInstanceOf Integer, 25, 'So close, but... No.' # => fail
356
- #
357
- def assertNotInstanceOf exclusion, object, message = nil
358
- __reject (object.instance_of? exclusion), 'Object should NOT be this instance', message, {:exclusion=>exclusion, :object=>object}
359
- end
360
-
361
- #
362
- # Assert that an object responds to particular method
363
- # * raises RubyUnit::AssertionFailure unless _object_ responds to _method_
364
- #
365
- # object::
366
- # The object to check
367
- #
368
- # method::
369
- # The method to assert on the object
370
- #
371
- # message::
372
- # The message provided to be reported for a failure
373
- #
374
- # assertRespondTo /^Regexp/, :length, 'It does not, so... no' # => fail
375
- #
376
- def assertRespondTo object, method, message = nil
377
- __assert (object.respond_to? method), 'Failed to assert object responds to method', message, {:object=>object, :method=>method}
378
- end
379
-
380
- #
381
- # Assert that an object does not respond to a particular method
382
- # * raises RubyUnit::AssertionFailure if _object_ responds to _method_
383
- #
384
- # object::
385
- # The object to check
386
- #
387
- # method::
388
- # The method to assert on the object
389
- #
390
- # message::
391
- # The message provided to be reported for a failure
392
- #
393
- # assertNotRespondTo 25, :integer?, 'It does, so close' # => fail
394
- #
395
- def assertNotRespondTo object, method, message = nil
396
- __assert (object.respond_to? method), 'Object should NOT respond to method', message, {:object=>object, :method=>method}
397
- end
398
-
399
- #
400
- # Assert that a collection includes a specified value
401
- # * raises RubyUnit::AssertionFailure unless _collection_ responds to _value_
402
- #
403
- # object::
404
- # The collection to check
405
- #
406
- # method::
407
- # The value the object should contain
408
- #
409
- # message::
410
- # The message provided to be reported for a failure
411
- #
412
- # assertInclude [1, 2], 'not in', 'It does not, so... no' # => fail
413
- #
414
- def assertInclude collection, value, message = nil
415
- assertRespondTo collection, :include?, message
416
- __assert (collection.include? value), 'Failed to assert collection includes value', message, {:collection=>collection, :value=>value}
417
- end
418
-
419
- #
420
- # Assert that a collection does not include a specified value
421
- # * raises RubyUnit::AssertionFailure if _collection_ responds to _value_
422
- #
423
- # object::
424
- # The collection to check
425
- #
426
- # method::
427
- # The value the object should not contain
428
- #
429
- # message::
430
- # The message provided to be reported for a failure
431
- #
432
- # assertNotInclude [1, 2, 3], 2, 'It does, so close' # => fail
433
- #
434
- def assertNotInclude collection, value, message = nil
435
- assertRespondTo collection, :include?, message
436
- __reject (collection.include? value), 'Collection should NOT include value', message, {:collection=>collection, :value=>value}
437
- end
438
-
439
- #
440
- # Assert that a class is a descendent of another class
441
- # * raises RubyUnit::AssertionFailure unless _descendent_ is a descendent of _klass_
442
- #
443
- # klass::
444
- # The parent class
445
- #
446
- # descendent::
447
- # The descendent class
448
- #
449
- # message::
450
- # The message provided to be reported for a failure
451
- #
452
- # assertDescendent Numeric, Exception, 'Nope' # => fail
453
- #
454
- def assertDescendent klass, descendent, message = nil
455
- __assert (descendent < klass), 'Failed to assert class heritage', message, {:klass=>klass, :descendent=>descendent}
456
- end
457
-
458
- #
459
- # Assert that a class is not a descendent of another class
460
- # * raises RubyUnit::AssertionFailure if _illegal_ is a descendent of _klass_
461
- #
462
- # klass::
463
- # The parent class
464
- #
465
- # descendent::
466
- # The illegal descendent class
467
- #
468
- # message::
469
- # The message provided to be reported for a failure
470
- #
471
- # assertDescendent StandardError, Exception, 'It is' # => fail
472
- #
473
- def assertNotDescendent klass, illegal, message = nil
474
- __reject (descendent < klass), 'Class should NOT be a descendent', message, {:klass=>klass, :descendent=>descendent}
475
- end
476
-
477
- #
478
- # Assert that a constant is defined correctly in the correct class
479
- # * raises RubyUnit::AssertionFailure unless the constant is defined in
480
- # the specified class and it is the correct type and value
481
- #
482
- # expected::
483
- # The value that is expected for the constant
484
- #
485
- # klass::
486
- # The class where the constant should be defined
487
- #
488
- # konstant::
489
- # The name of the constant
490
- #
491
- # message::
492
- # The message provided to be reported for a failure
493
- #
494
- # assertConst 42, Numbers, 'TWENTYFOUR', 'So dyslexic.' # => fail
495
- #
496
- def assertConst expected, klass, konstant, message = nil
497
- __wrap_assertion do
498
- assertConstDefined klass, konstant, message
499
- value = klass.const_get konstant
500
- assertIsA expected.class, value, message
501
- assertEqual expected, value, message
502
- end
503
- end
504
-
505
- #
506
- # Assert that a constant is defined in the specified class
507
- # * raises RubyUnit::AssertionFailure unless the constant is defined in
508
- # the specified class
509
- #
510
- # klass::
511
- # The class where the constant should be defined
512
- #
513
- # konstant::
514
- # The name of the constant
515
- #
516
- # message::
517
- # The message provided to be reported for a failure
518
- #
519
- # assertConstDefined Numbers, 'FORTYTWO', 'Mystery.' # => ??
520
- #
521
- def assertConstDefined klass, konstant, message = nil
522
- __assert (klass.const_defined? konstant), 'Failed to assert constant is defined', message, {:klass=>klass, :konstant=>konstant}
523
- end
524
-
525
- #
526
- # Assert that a constant is not defined in the specified class
527
- # * raises RubyUnit::AssertionFailure if the constant is defined in
528
- # the specified class
529
- #
530
- # klass::
531
- # The class where the constant should not be defined
532
- #
533
- # konstant::
534
- # The name of the constant
535
- #
536
- # message::
537
- # The message provided to be reported for a failure
538
- #
539
- # assertConstNotDefined Numbers, 'TWENTYFOUR', 'Mystery.' # => ??
540
- #
541
- def assertConstNotDefined klass, konstant, message = nil
542
- __reject (klass.const_defined? konstant), 'Constant should not be defined', message, {:klass=>klass, :konstant=>konstant}
543
- end
544
-
545
- #
546
- # Assert that no exception is raised.
547
- # * raises RubyUnit::AssertionFailure if any exception is raised
548
- #
549
- # message::
550
- # The message provided to be reported for a failure
551
- #
552
- # &block::
553
- # The code block that is executed
554
- #
555
- # assertNothingRaised 'Not expecting an exception!' do
556
- # # do something
557
- # end
558
- #
559
- def assertNothingRaised message = nil, &block
560
- __wrap_assertion do
561
- begin
562
- yield
563
- rescue Exception => e
564
- build_message 'Exception should NOT be raised', message, {:exception=>e.message}
565
- end
566
- end
567
- end
568
-
569
- #
570
- # Assert that a specified exception message is raised.
571
- # * raises RubyUnit::AssertionFailure unless the correct Exception message is raised
572
- #
573
- # pattern::
574
- # The String or Regexp that will be used to validate the Exception message
575
- #
576
- # message::
577
- # The message provided to be reported for a failure
578
- #
579
- # &block::
580
- # The code block that is expected to throw the Exception
581
- #
582
- # assertRaiseMessage /^Invalid/, 'Expecting an exception!' do
583
- # # do something
584
- # end
585
- #
586
- def assertRaiseMessage pattern, message = nil, &block
587
- assertRaiseExpected Exception, pattern, message, &block
588
- end
589
-
590
- #
591
- # Assert that a specified exception type is raised.
592
- # * raises RubyUnit::AssertionFailure unless the correct Exception type is raised
593
- #
594
- # e::
595
- # The Exception class that is expected.
596
- #
597
- # message::
598
- # The message provided to be reported for a failure
599
- #
600
- # &block::
601
- # The code block that is expected to throw the Exception
602
- #
603
- # assertRaiseKindOf StandardError, 'Expecting an exception!' do # => fail
604
- # # do something
605
- # end
606
- #
607
- def assertRaiseKindOf e, message = nil, &block
608
- assertRaiseExpected e, '', message, &block
609
- end
610
-
611
- #
612
- # Assert that a specified exception is raised.
613
- # * raises RubyUnit::AssertionFailure unless the correct Exception is raised
614
- #
615
- # exception::
616
- # The Exception class that is expected.
617
- #
618
- # pattern::
619
- # The String or Regexp that will be used to validate the Exception message
620
- #
621
- # message::
622
- # The message provided to be reported for a failure
623
- #
624
- # &block::
625
- # The code block that is expected to throw the Exception
626
- #
627
- # assertRaiseExpected StandardError, /^Invalid/, 'Expecting an exception!' do
628
- # raise StandardError, 'Invalid Retroincabulator'
629
- # end
630
- #
631
- def assertRaiseExpected exception, pattern, message = nil, &block
632
- __validate_exception pattern, exception
633
- __wrap_assertion do
634
- begin
635
- yield
636
- build_message 'Expected exception was not raised', message, {:exception=>exception, :pattern=>pattern}
637
- rescue exception => e
638
- assertEqual pattern, e.message if pattern.is_a? String and pattern.length > 0
639
- assertMatch pattern, e.message if pattern.is_a? Regexp
640
- e
641
- end
642
- end
643
- end
644
-
645
11
  private
646
12
  #
647
13
  # Builds the message that will be used with the assertion
@@ -738,3 +104,10 @@ module RubyUnit
738
104
  end
739
105
  end
740
106
  end
107
+
108
+ require_relative 'Assertions/Basic' # Basic assertions
109
+ require_relative 'Assertions/Class' # Class assertions
110
+ require_relative 'Assertions/Collection' # Collection assertions
111
+ require_relative 'Assertions/Comparison' # Comparison assertions
112
+ require_relative 'Assertions/Exception' # Exception assertions
113
+ require_relative 'Assertions/Method' # Method assertions
@@ -164,6 +164,7 @@ module RubyUnit
164
164
  @@tests += 1
165
165
  test_case.setup
166
166
  test_case.send test, *params
167
+ test_case.teardown
167
168
  rescue AssertionFailure => failure
168
169
  @@failures << [test_case.class.name, test, params, failure]
169
170
  rescue SkippedTest => skip
@@ -172,8 +173,6 @@ module RubyUnit
172
173
  @@incompletes << [test_case.class.name, test, params, incomplete]
173
174
  rescue Exception => error
174
175
  @@errors << [test_case.class.name, test, params, error]
175
- ensure
176
- test_case.teardown
177
176
  end
178
177
  end
179
178
  end