7.5. rake stats

With rake stats you get an overview of your Rails project. For our example, it looks like this:
$ rake stats
+----------------------+-------+-------+---------+---------+-----+-------+
| Name                 | Lines |   LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers          |    86 |    61 |       2 |       7 |   3 |     6 |
| Helpers              |     4 |     4 |       0 |       0 |   0 |     0 |
| Models               |    13 |    11 |       1 |       0 |   0 |     0 |
| Libraries            |     0 |     0 |       0 |       0 |   0 |     0 |
| Integration tests    |    16 |    12 |       1 |       0 |   0 |     0 |
| Functional tests     |    49 |    39 |       1 |       0 |   0 |     0 |
| Unit tests           |    28 |    24 |       2 |       0 |   0 |     0 |
+----------------------+-------+-------+---------+---------+-----+-------+
| Total                |   196 |   151 |       7 |       7 |   1 |    19 |
+----------------------+-------+-------+---------+---------+-----+-------+
  Code LOC: 76     Test LOC: 75     Code to Test Ratio: 1:1.0

$
In this project, we have a total of 76 LOC (Lines Of Code => program lines) in the controllers, helpers and models. Plus we have a total of 75 LOC for tests. This gives us a test relation of 1:1.0, which should be the principal objective. Logically, this does not say anything about the quality of tests.

Updates about this book will be published on my Twitter feed.