pat / combustion

Simple, elegant testing for Rails Engines
MIT License
707 stars 51 forks source link

combustion 1.3.6 fails to require sprockets for Rails 6.1.1+ #128

Closed jrochkind closed 2 years ago

jrochkind commented 2 years ago

Upgrading from combustion 1.3.5 to 1.3.6 caused my project build for Rails 6.1 to start failing with:

         ActionController::RoutingError:
       No route matches [GET] "/javascripts/application.js"

I confirmed that the difference between combustion 1.3.5 and 1.3.6 alone determines green/red.

Oddly, my project was still passing fine for Rails 6.0 and 7.0 -- failing only for Rails 6.1.

Rather than spend time getting to the bottom of this somewhat confusing situation, I was considering just locking to combustion 1.3.5 in my Appraisal gemfile for Rails 6.1. ¯\(ツ)

But... took a look at the diff.... https://github.com/pat/combustion/compare/v1.3.5...v1.3.6 ...

Hmm, it it possible sprockets is no longer being included for Rails 6.1 because of different logic here? Maybe the new rails_gate.call(">= 3.1", "<= 6.1") will not actually pass for Rails 6.1.6, is 6.1.6 <= 6.1 according to rails_gate?

Yep, debugging, I think that's it. rails_gate.call(">= 3.1", "<= 6.1") is false for Rails 6.1.6. I think you mean it to be true for any Rails 6.1.x, but in fact it's true for 6.1.0 but not 6.1.1+.

One way to workaround: manually adding sprockets-rails to my Gemfile resolves the problem (I think because having it in top-level Gemfile is one way to force the require that combustion is erroneously deciding not to do).

Editing combustion source to change that line to eg rails_gate.call(">= 3.1", "< 6.2") resolved the problem for me too.

It would probably be useful to have some specs for the VersionGate class, verifying it's behavior.

pat commented 2 years ago

Thanks for the debugging @jrochkind, that's super helpful :) I've just pushed a fix and released a new version as well (1.3.7).