1

レーキ統計の変更前

+----------------------+-------+-------+---------+---------+-----+-------+
| Name                 | Lines |   LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers          |  5037 |  3936 |      31 |     292 |   9 |    11 |
| Helpers              |   150 |   128 |       0 |      17 |   0 |     5 |
| Models               |  1523 |  1166 |      42 |     123 |   2 |     7 |
| Libraries            |   633 |   415 |       4 |      65 |  16 |     4 |
| Functional tests     |   289 |   228 |      13 |       0 |   0 |     0 |
| Unit tests           |   560 |   389 |      30 |       0 |   0 |     0 |
| Model specs          |  1085 |   904 |       0 |       3 |   0 |   299 |
| View specs           |    88 |    75 |       0 |       0 |   0 |     0 |
| Controller specs     |   468 |   388 |       0 |       2 |   0 |   192 |
+----------------------+-------+-------+---------+---------+-----+-------+
| Total                |  9833 |  7629 |     120 |     502 |   4 |    13 |
+----------------------+-------+-------+---------+---------+-----+-------+
  Code LOC: 5645     Test LOC: 1984     Code to Test Ratio: 1:0.4

今、追加すると:

#Factories
::STATS_DIRECTORIES << %w(Factories\ specs test/factories) if File.exist?('test/factories')
::CodeStatistics::TEST_TYPES << "Factory specs" if File.exist?('test/factories')

120 行あたりで、テスト LOC が増加するはずですよね?

+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers          |  5037 |  3936 |      31 |     292 |   9 |    11 |
| Helpers              |   150 |   128 |       0 |      17 |   0 |     5 |
| Models               |  1523 |  1166 |      42 |     123 |   2 |     7 |
| Libraries            |   633 |   415 |       4 |      65 |  16 |     4 |
| Functional tests     |   289 |   228 |      13 |       0 |   0 |     0 |
| Unit tests           |   560 |   389 |      30 |       0 |   0 |     0 |
| Model specs          |  1085 |   904 |       0 |       3 |   0 |   299 |
| View specs           |    88 |    75 |       0 |       0 |   0 |     0 |
| Controller specs     |   468 |   388 |       0 |       2 |   0 |   192 |
| Factories specs      |   144 |   119 |       0 |       0 |   0 |     0 |
+----------------------+-------+-------+---------+---------+-----+-------+
| Total                |  9977 |  7748 |     120 |     502 |   4 |    13 |
+----------------------+-------+-------+---------+---------+-----+-------+
  Code LOC: 5764     Test LOC: 1984     Code to Test Ratio: 1:0.3

工場からの 144 行をテスト LOC に追加する代わりに、コード LOC に追加します =\ 行数をテスト LOC にするにはどうすればよいですか?

4

1 に答える 1

2

「Factoriesspecs」(複数形)と呼ばれるものを配列に追加しますが、配列STATS_DIRECTORIESに追加するときは「Factory specs」(単数形)と呼びます。したがって、フォルダーにヒットすると、「Factoriesspecs」が検索されます。 、それを見つけられず、テストではなくコードであると想定します。あなたはそれを両方の場所で同じものと呼ぶ必要があります:TEST_TYPESrake:stattest/factoriesTEST_TYPES

::STATS_DIRECTORIES << %w(Factory\ specs test/factories) if File.exist?('test/factories')
::CodeStatistics::TEST_TYPES << "Factory specs" if File.exist?('test/factories')
于 2011-06-22T14:48:12.527 に答える