Ruby Flare

Your awesome Tagline

9 notes

Add cucumber to rake stats

I added the following to the statsetup task in rspec.rake inside my rails app:

::STATS_DIRECTORIES << %w( Cucumber\ features features ) if File.exist?('features')
::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')

Now when I run rake stats, I get:

+----------------------+-------+-------+---------+---------+-----+-------+
| Name                 | Lines |   LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers          |  1970 |  1576 |      24 |     174 |   7 |     7 |
| Helpers              |   449 |   355 |       0 |      55 |   0 |     4 |
| Models               |  3589 |  2560 |      68 |     257 |   3 |     7 |
| Libraries            |   645 |   444 |      11 |      50 |   4 |     6 |
| Model specs          |  4850 |  4047 |       2 |      15 |   7 |   267 |
| View specs           |   476 |   409 |       0 |       0 |   0 |     0 |
| Controller specs     |  2880 |  2487 |       0 |      42 |   0 |    57 |
| Helper specs         |   331 |   303 |       0 |       0 |   0 |     0 |
| Library specs        |   144 |   126 |       0 |       0 |   0 |     0 |
| Cucumber features    |  2446 |  1737 |       1 |       9 |   9 |   191 |
+----------------------+-------+-------+---------+---------+-----+-------+
| Total                | 17780 | 14044 |     106 |     602 |   5 |    21 |
+----------------------+-------+-------+---------+---------+-----+-------+
  Code LOC: 4935     Test LOC: 9109     Code to Test Ratio: 1:1.8

(Source: github.com)

Filed under rails rspec rake stats

  1. rubyflare posted this