Closed shir closed 4 years ago
@shir This is new sprockets behavior (see https://github.com/rails/sprockets/blob/master/UPGRADING.md). I agree this should be handled in combustion somehow. Here is a workaround for the meantime:
Its working in a newly created rails dummy app because it'll contain a manifest.js
which is required by sprockets
v4. Here is a example:
/my_engine_with_rails_dummy/app/assets/config/my_engine_with_rails_dummy_manifest.js
:
//= link_directory ../javascripts/my_engine_with_rails_dummy .js
//= link_directory ../stylesheets/my_engine_with_rails_dummy .css
/my_engine_with_rails_dummy/test/dummy/app/assets/config/manifest.js
:
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
//= link my_engine_with_rails_dummy_manifest.js
You can basically copy this second file into your combustion test skeleton folder (mine is spec/internal/app/assets/config
), you need to adjust the engine names/paths and it should work.
Thanks @wintersolutions, your suggestion sounds correct to me. @shir: I would certainly appreciate the confirmation that this has worked for you before I add it to the generator in Combustion :)
This is all very confusing, the research I did on it can be found at https://bibwild.wordpress.com/2019/10/15/sprockets-4-and-your-rails-app/
I think that the manifest.js to the generator is probably the right solution. The Rails-generated content of the manifest_js is technically different for Rails 5.x apps and Rails 6.0 apps though -- the Rails 6.0-generated apps don't have //= link_directory ../javascripts .js
in them, since in Rails 6 sprockets is not expected to be used with JS.
I'm not sure what that means for what combustion should generate, or if it will cause a problem to do the Rails 5.2 one.
I also don't really like what Rails is generating at all, I think it should have been what Sprockets-maintainer schneems suggested to Rails, but Rails maintainers denied. :( https://github.com/rails/rails/pull/28430
It's all pretty messy.
Hmm, the combustion-generated skeleton doesn't have an app/assets/images
, so putting link_tree ../images
in the manifest actually generates an error.
The combustion-generated skeleton also doesn't seem to have an app/asset/stylesheets
or an application.css
... in my app, I think I might try a manifest.js
that is only //= link application.js
, for the application.js
the combustion-generated skeleton DOES have.
@jrochkind Can the manifest file be empty? I guess that's what I'd probably default to (but if I'm generating a JS file, then I guess it makes sense to reference that).
Thanks to all. Just adding an empty file spec/internal/app/assets/config/manifest.js
helped.
But I think it should be fixed within cumbustion.
Just pushed the v1.1.2 release that generates an empty manifest file as part of the combust
call. Thanks all for the input here :)
When I run specs with combustion configured I have next error:
This error is for any spec. Everything works when I use rails generated dummy application.
My environment:
Dependencies:
I've tried to run both with appraisal and without with same result
Rails version actually installed 5.2.3
My
spec/rails_helper.rb
spec/internal/routes.rb
:(real engine name instead
App
). Without mounting engine or mounting it on another endpoint I have the same error.