Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions test/fixtures/console-output.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
+-----------------------|------------|----------------+
| Name | Total Deps | 1st Level Deps |
+-----------------------|------------|----------------+
| simplecov-console | 8 | 3 |
| codecov | 4 | 1 |
| rails_stats | 4 | 2 |
| simplecov | 3 | 3 |
| minitest-around | 1 | 1 |
| bundler | 0 | 0 |
| byebug | 0 | 0 |
| minitest | 0 | 0 |
| minitest-spec-context | 0 | 0 |
+-----------------------|------------|----------------+

Declared Gems 9
Total Gems 18
Unpinned Versions 6
Github Refs 0
Copy link
Copy Markdown
Member Author

@JuanVqz JuanVqz Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruby 3.3/3.4 resolves:
simplecov-console (0.9.2)
minitest-around (0.5.0)
terminal-table 3.0.2 → unicode-display_width (< 3)
(no unicode-emoji)
Total Gems: 17

Ruby 3.0/3.1 resolves:
simplecov-console (0.9.5)
minitest-around (0.6.0)
terminal-table → unicode-display_width (< 4)
→ unicode-emoji (~> 4.1)
Total Gems: 18

The reason is that bundle install picks different gem versions depending on the Ruby version. newer Ruby gets newer gem versions with different dependency trees. For example, terminal-table on older Ruby
pulls in unicode-emoji as an extra transitive dependency, which adds one more gem to the total count and changes the dependency numbers for simplecov-console.

That's why the bundler-stats portion of the output can't be pinned to a single expected value across the CI matrix; also, the tests didn't check it previously.


+----------------------+---------+---------+---------+---------+---------+-----+-------+
| Name | Files | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+---------+---------+---------+---------+---------+-----+-------+
Expand Down
13 changes: 5 additions & 8 deletions test/lib/rails_stats/code_statistics_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@
describe "#to_s" do
it "outputs useful stats for a Rails project" do
root_directory = File.expand_path('../../../test/dummy', File.dirname(__FILE__))
table = File.read(File.expand_path('../../../fixtures/console-output.txt', __FILE__))
expected_table = File.read(File.expand_path('../../../fixtures/console-output.txt', __FILE__))

out, err = capture_io do
RailsStats::CodeStatistics.new(root_directory).to_s
end
expected_bundler_table, _ = capture_io { Bundler::Stats::CLI.start }

assert_equal(
table.lines.map(&:rstrip).join,
out.lines.map(&:rstrip).join
)
output, _ = capture_io { RailsStats::CodeStatistics.new(root_directory).to_s }

assert_equal([expected_bundler_table, expected_table].join, output)
end
end
end
Loading