@@ -7,4 +7,81 @@ $ ruby hamming_test.rb
7
7
```
8
8
9
9
Only the first test will be executed, all the others have been made pending
10
- using the ` skip ` method. Delete the next ` skip ` as you get each test passing.
10
+ using the ` skip ` method. Delete or comment the next ` skip ` as you get
11
+ each test passing.
12
+
13
+ ## Customizing Test Reporting
14
+
15
+ If you want color, execute the tests with:
16
+
17
+ ``` bash
18
+ $ ruby hamming_test.rb -p
19
+ ```
20
+
21
+ If you want to see the test names, execute the tests with:
22
+
23
+ ``` bash
24
+ $ ruby hamming_tests.rb -v
25
+ ```
26
+
27
+ If you would like to run only one test, you can specify one or a group
28
+ with regular expression style matching.
29
+
30
+ ``` bash
31
+ $ ruby hamming_tests.rb -n /empty/
32
+ ```
33
+
34
+ You can combine the options as well.
35
+
36
+ ## Disabling All The Skips
37
+
38
+ With your new found powers of being able to select the individual or
39
+ groups of tests that you want to run, you may want to disable all the
40
+ skips.
41
+
42
+ ### The Quick and Dirty
43
+
44
+ Taking advantage of the fact that in Ruby methods are overridable, if
45
+ you were to add this line of code;
46
+
47
+ ``` ruby
48
+ def skip ; end
49
+ ```
50
+
51
+ like this in the Hamming test file
52
+
53
+ ``` ruby
54
+ class HammingTest < Minitest ::Test
55
+ def skip ; end
56
+ def test_identical_strands
57
+ ```
58
+
59
+ then all the skips will still evaluate, yet will let your tests run.
60
+
61
+ ### The Still Quick And Cleaner
62
+
63
+ Of course, editing all the files through time can be irritating, so you
64
+ could do like we did in developing the exercises... make a file that has
65
+ the skip definition in it, and require that as a library when we want
66
+ it.
67
+
68
+ We created a ` lib ` folder to keep our "helper" things in, and it looks
69
+ like this:
70
+
71
+ ``` ruby
72
+ require ' minitest/autorun'
73
+ # You can use this to disabe all skips in the current exercise by issuing the
74
+ # following command:
75
+ # ruby -I../lib -rdisable_skip <fiename_test.rb>
76
+
77
+ module Minitest
78
+ class Test
79
+ def skip (_msg = ' ' , _bt = caller )
80
+ end
81
+ end
82
+ end
83
+ ```
84
+
85
+ The description on how to use it is commented in that file listing, and
86
+ the file listing is in its complete state.
87
+
0 commit comments