|
6 | 6 |
|
7 | 7 | describe RailsStats::CodeStatistics do
|
8 | 8 | describe "#to_s" do
|
9 |
| - TABLE = <<~EOS |
10 |
| -+-----------------------|------------|----------------+ |
11 |
| -| Name | Total Deps | 1st Level Deps | |
12 |
| -+-----------------------|------------|----------------+ |
13 |
| -| simplecov-console | 7 | 3 | |
14 |
| -| codecov | 5 | 2 | |
15 |
| -| rails_stats | 4 | 2 | |
16 |
| -| simplecov | 3 | 3 | |
17 |
| -| minitest-around | 1 | 1 | |
18 |
| -| bundler | 0 | 0 | |
19 |
| -| byebug | 0 | 0 | |
20 |
| -| minitest | 0 | 0 | |
21 |
| -| minitest-spec-context | 0 | 0 | |
22 |
| -+-----------------------|------------|----------------+ |
23 |
| -
|
24 |
| - Declared Gems 9 |
25 |
| - Total Gems 18 |
26 |
| - Unpinned Versions 8 |
27 |
| - Github Refs 0 |
28 |
| - |
29 |
| -+----------------------+---------+---------+---------+---------+---------+-----+-------+ |
30 |
| -| Name | Files | Lines | LOC | Classes | Methods | M/C | LOC/M | |
31 |
| -+----------------------+---------+---------+---------+---------+---------+-----+-------+ |
32 |
| -| Channels | 2 | 8 | 8 | 2 | 0 | 0 | 0 | |
33 |
| -| Configuration | 19 | 417 | 111 | 1 | 0 | 0 | 0 | |
34 |
| -| Controllers | 1 | 7 | 6 | 1 | 1 | 1 | 4 | |
35 |
| -| Helpers | 1 | 3 | 3 | 0 | 0 | 0 | 0 | |
36 |
| -| Javascripts | 3 | 27 | 7 | 0 | 0 | 0 | 0 | |
37 |
| -| Jobs | 1 | 7 | 2 | 1 | 0 | 0 | 0 | |
38 |
| -| Libraries | 1 | 1 | 1 | 0 | 0 | 0 | 0 | |
39 |
| -| Mailers | 1 | 4 | 4 | 1 | 0 | 0 | 0 | |
40 |
| -| Model Tests | 2 | 5 | 4 | 2 | 0 | 0 | 0 | |
41 |
| -| Models | 1 | 3 | 3 | 1 | 0 | 0 | 0 | |
42 |
| -| Spec Support | 1 | 1 | 1 | 0 | 0 | 0 | 0 | |
43 |
| -| Test Support | 1 | 1 | 1 | 0 | 0 | 0 | 0 | |
44 |
| -+----------------------+---------+---------+---------+---------+---------+-----+-------+ |
45 |
| -| Code | 30 | 477 | 145 | 7 | 1 | 0 | 143 | |
46 |
| -| Tests | 4 | 7 | 6 | 2 | 0 | 0 | 0 | |
47 |
| -| Total | 34 | 484 | 151 | 9 | 1 | 0 | 149 | |
48 |
| -+----------------------+---------+---------+---------+---------+---------+-----+-------+ |
49 |
| - Code LOC: 145 Test LOC: 6 Code to Test Ratio: 1:0.0 Files: 34 |
50 |
| -EOS |
51 |
| - |
52 | 9 | it "outputs useful stats for a Rails project" do
|
53 | 10 | root_directory = File.expand_path('../../../test/dummy', File.dirname(__FILE__))
|
| 11 | + table = File.read(File.expand_path('../../../fixtures/console-output.txt', __FILE__)) |
54 | 12 |
|
55 | 13 | out, err = capture_io do
|
56 | 14 | RailsStats::CodeStatistics.new(root_directory).to_s
|
57 | 15 | end
|
58 | 16 |
|
59 |
| - assert_equal TABLE, out |
| 17 | + assert_equal table.delete(" \n"), out.delete(" \n") |
60 | 18 | end
|
61 | 19 | end
|
62 | 20 | end
|
0 commit comments