Skip to content

Commit eed28bd

Browse files
committed
Make test less strict about whitespace
We don't really care about whitespaces when comparing console output
1 parent 5646bcf commit eed28bd

File tree

1 file changed

+2
-44
lines changed

1 file changed

+2
-44
lines changed

test/lib/rails_stats/code_statistics_test.rb

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,57 +6,15 @@
66

77
describe RailsStats::CodeStatistics do
88
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-
529
it "outputs useful stats for a Rails project" do
5310
root_directory = File.expand_path('../../../test/dummy', File.dirname(__FILE__))
11+
table = File.read(File.expand_path('../../../fixtures/console-output.txt', __FILE__))
5412

5513
out, err = capture_io do
5614
RailsStats::CodeStatistics.new(root_directory).to_s
5715
end
5816

59-
assert_equal TABLE, out
17+
assert_equal table.delete(" \n"), out.delete(" \n")
6018
end
6119
end
6220
end

0 commit comments

Comments
 (0)