Skip to content

Stop asserting on bundler-stats output in tests#46

Merged
JuanVqz merged 4 commits intomainfrom
fix/json_formatter
Mar 31, 2026
Merged

Stop asserting on bundler-stats output in tests#46
JuanVqz merged 4 commits intomainfrom
fix/json_formatter

Conversation

@JuanVqz
Copy link
Copy Markdown
Member

@JuanVqz JuanVqz commented Mar 30, 2026

Closes #45

Summary

  • Tests were failing on CI for certain Ruby versions (3.0, 3.1 then 2.5 and so...) because bundler-stats resolves different gem versions and dependency counts depending on the Ruby version
  • Since rails_stats just passes through bundler-stats data without processing it, asserting on specific gem versions was testing bundler-stats behavior rather than rails_stats logic
  • Updated tests to verify structure and gem names from bundler-stats without asserting on version-specific values
  • Code stats, totals, schema stats, and polymorphic stats assertions remain exact (they are stable across Ruby versions)
  • Console output test now strips the bundler-stats gem table before comparing, keeping the full fixture for documentation purposes

Test plan

  • bundle exec rake test passes locally
  • CI passes across all Ruby versions (2.5 through 3.4)

@JuanVqz JuanVqz force-pushed the fix/json_formatter branch 2 times, most recently from c850497 to af4e302 Compare March 31, 2026 06:42
@JuanVqz JuanVqz changed the title Fix tests Stop asserting on bundler-stats output in tests Mar 31, 2026
JuanVqz added 2 commits March 31, 2026 00:49
Replace verbose hash literals with code_stat() and total_stat() helpers
that use keyword arguments with sensible defaults, making the test
expectations easier to scan and maintain.
The gem dependency table was never compared in tests (it was stripped
before assertion) and contained outdated values. The fixture now only
contains the code stats table that is actually asserted on.
@JuanVqz JuanVqz force-pushed the fix/json_formatter branch from af4e302 to d91b1be Compare March 31, 2026 06:55
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.

@JuanVqz JuanVqz self-assigned this Mar 31, 2026
@JuanVqz JuanVqz marked this pull request as ready for review March 31, 2026 07:05
@jeremysmithco jeremysmithco self-requested a review March 31, 2026 15:18
Copy link
Copy Markdown

@jeremysmithco jeremysmithco left a comment

Choose a reason for hiding this comment

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

Hey, this looks good! I had one optional suggestion.

(There are some other underlying issues in this library that I noticed that I'd like to talk about later that I think we could address relatively easily, and would make testing easier.)

@JuanVqz JuanVqz merged commit 90277fd into main Mar 31, 2026
8 checks passed
@JuanVqz JuanVqz deleted the fix/json_formatter branch March 31, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get RailsStatus out of failing CI

2 participants