|
2 | 2 |
|
3 | 3 | require "test_helper" |
4 | 4 |
|
| 5 | +Minitest::Test.make_my_diffs_pretty! |
| 6 | + |
5 | 7 | describe RailsStats::CodeStatistics do |
6 | 8 | describe "#to_s" do |
7 | | - TABLE = <<~EOS |
| 9 | + TABLE = <<~EOS |
8 | 10 | +-----------------------|------------|----------------+ |
9 | 11 | | Name | Total Deps | 1st Level Deps | |
10 | 12 | +-----------------------|------------|----------------+ |
11 | 13 | | simplecov-console | 7 | 3 | |
12 | | -| codecov | 4 | 1 | |
| 14 | +| codecov | 5 | 2 | |
13 | 15 | | rails_stats | 4 | 2 | |
14 | 16 | | simplecov | 3 | 3 | |
15 | 17 | | minitest-around | 1 | 1 | |
|
18 | 20 | | minitest | 0 | 0 | |
19 | 21 | | minitest-spec-context | 0 | 0 | |
20 | 22 | +-----------------------|------------|----------------+ |
21 | | - \n Declared Gems 9 \n Total Gems 17 \n Unpinned Versions 8 \n Github Refs 0 \n \n+----------------------+---------+---------+---------+---------+-----+-------+ |
22 | | -| Name | Lines | LOC | Classes | Methods | M/C | LOC/M | |
23 | | -+----------------------+---------+---------+---------+---------+-----+-------+ |
24 | | -| Channels | 8 | 8 | 2 | 0 | 0 | 0 | |
25 | | -| Configuration | 417 | 111 | 1 | 0 | 0 | 0 | |
26 | | -| Controllers | 7 | 6 | 1 | 1 | 1 | 4 | |
27 | | -| Helpers | 3 | 3 | 0 | 0 | 0 | 0 | |
28 | | -| Javascripts | 27 | 7 | 0 | 0 | 0 | 0 | |
29 | | -| Jobs | 7 | 2 | 1 | 0 | 0 | 0 | |
30 | | -| Libraries | 1 | 1 | 0 | 0 | 0 | 0 | |
31 | | -| Mailers | 4 | 4 | 1 | 0 | 0 | 0 | |
32 | | -| Model Tests | 5 | 4 | 2 | 0 | 0 | 0 | |
33 | | -| Models | 3 | 3 | 1 | 0 | 0 | 0 | |
34 | | -| Spec Support | 1 | 1 | 0 | 0 | 0 | 0 | |
35 | | -| Test Support | 1 | 1 | 0 | 0 | 0 | 0 | |
36 | | -+----------------------+---------+---------+---------+---------+-----+-------+ |
37 | | -| Code | 477 | 145 | 7 | 1 | 0 | 143 | |
38 | | -| Tests | 7 | 6 | 2 | 0 | 0 | 0 | |
39 | | -| Total | 484 | 151 | 9 | 1 | 0 | 149 | |
40 | | -+----------------------+---------+---------+---------+---------+-----+-------+ |
41 | | - Code LOC: 145 Test LOC: 6 Code to Test Ratio: 1:0.0 |
42 | | -
|
43 | | - EOS |
44 | | - |
45 | | - TABLE_RUBY_2_4 = <<~EOS |
46 | | -+-----------------------|------------|----------------+ |
47 | | -| Name | Total Deps | 1st Level Deps | |
48 | | -+-----------------------|------------|----------------+ |
49 | | -| simplecov-console | 6 | 3 | |
50 | | -| rails_stats | 4 | 2 | |
51 | | -| codecov | 3 | 1 | |
52 | | -| simplecov | 2 | 2 | |
53 | | -| minitest-around | 1 | 1 | |
54 | | -| bundler | 0 | 0 | |
55 | | -| byebug | 0 | 0 | |
56 | | -| minitest | 0 | 0 | |
57 | | -| minitest-spec-context | 0 | 0 | |
58 | | -+-----------------------|------------|----------------+ |
59 | | - \n Declared Gems 9 \n Total Gems 16 \n Unpinned Versions 8 \n Github Refs 0 \n \n+----------------------+---------+---------+---------+---------+-----+-------+ |
60 | | -| Name | Lines | LOC | Classes | Methods | M/C | LOC/M | |
61 | | -+----------------------+---------+---------+---------+---------+-----+-------+ |
62 | | -| Channels | 8 | 8 | 2 | 0 | 0 | 0 | |
63 | | -| Configuration | 417 | 111 | 1 | 0 | 0 | 0 | |
64 | | -| Controllers | 7 | 6 | 1 | 1 | 1 | 4 | |
65 | | -| Helpers | 3 | 3 | 0 | 0 | 0 | 0 | |
66 | | -| Javascripts | 27 | 7 | 0 | 0 | 0 | 0 | |
67 | | -| Jobs | 7 | 2 | 1 | 0 | 0 | 0 | |
68 | | -| Libraries | 1 | 1 | 0 | 0 | 0 | 0 | |
69 | | -| Mailers | 4 | 4 | 1 | 0 | 0 | 0 | |
70 | | -| Model Tests | 5 | 4 | 2 | 0 | 0 | 0 | |
71 | | -| Models | 3 | 3 | 1 | 0 | 0 | 0 | |
72 | | -| Spec Support | 1 | 1 | 0 | 0 | 0 | 0 | |
73 | | -| Test Support | 1 | 1 | 0 | 0 | 0 | 0 | |
74 | | -+----------------------+---------+---------+---------+---------+-----+-------+ |
75 | | -| Code | 477 | 145 | 7 | 1 | 0 | 143 | |
76 | | -| Tests | 7 | 6 | 2 | 0 | 0 | 0 | |
77 | | -| Total | 484 | 151 | 9 | 1 | 0 | 149 | |
78 | | -+----------------------+---------+---------+---------+---------+-----+-------+ |
79 | | - Code LOC: 145 Test LOC: 6 Code to Test Ratio: 1:0.0 |
80 | 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 |
81 | 50 | EOS |
82 | 51 |
|
83 | 52 | it "outputs useful stats for a Rails project" do |
|
87 | 56 | RailsStats::CodeStatistics.new(root_directory).to_s |
88 | 57 | end |
89 | 58 |
|
90 | | - expectation = if RUBY_VERSION < "2.5.0" |
91 | | - TABLE_RUBY_2_4 |
92 | | - else |
93 | | - TABLE |
94 | | - end |
95 | | - |
96 | | - assert_equal expectation, out |
| 59 | + assert_equal TABLE, out |
97 | 60 | end |
98 | 61 | end |
99 | 62 | end |
0 commit comments