Stop asserting on bundler-stats output in tests#46
Conversation
c850497 to
af4e302
Compare
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.
af4e302 to
d91b1be
Compare
| Declared Gems 9 | ||
| Total Gems 18 | ||
| Unpinned Versions 6 | ||
| Github Refs 0 |
There was a problem hiding this comment.
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.
jeremysmithco
left a comment
There was a problem hiding this comment.
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.)
Closes #45
Summary
bundler-statsresolves different gem versions and dependency counts depending on the Ruby versionrails_statsjust passes throughbundler-statsdata without processing it, asserting on specific gem versions was testingbundler-statsbehavior rather thanrails_statslogicbundler-statswithout asserting on version-specific valuesTest plan
bundle exec rake testpasses locally