Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need two assets compiled in rails test environment, but not compiled in rails production. #666

Open
mileslane opened this issue Mar 8, 2020 · 1 comment

Comments

@mileslane
Copy link

Expected behavior

With sprockets 4.0, there needs to be a way to differentiate between assets that need to be loaded in distinct rails environments. May there is a way to do this, but I haven't found it yet.

spec.js and spec.css are required for rspec to run automated tests against our application. However, these files are not seen by sprockets 4.0 when I try to deploy on AWS using OpsWorks.

Actual behavior

If I put those two files into the manifest.js file, the deployment breaks. If I leave those two files out of the manifest.js, my rspec tests will not run.

Tell us what happens instead

When running rspec without the two files in the manifest.js:

   Failure/Error: = stylesheet_link_tag 'spec', media: 'all' if Rails.env.test?
   ActionView::Template::Error:
     Asset `spec.css` was not declared to be precompiled in production.
     Declare links to your assets in `app/assets/config/manifest.js`.

When deploying on OpsWorks with the two files in manifest.js:

rake aborted!
Sprockets::FileNotFound: couldn't find file 'spec.js'

System configuration

  • Sprockets version 4.0
  • Ruby version 2.6.5

Example App (Reproduction) - THIS IS IMPORTANT YOUR ISSUE LIKELY WILL NOT BE RESOLVED WITHOUT THIS

Please provide an example app

I won't be able to set up an OpsWorks deployment on codetriage.com.
The problem is simple. How can I have assets compiled in when needed in development and test, and not be compiled for production.

@TomasBarry
Copy link

@mileslane, did you manage to get anywhere with this? I am coming across the same issue.

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

No branches or pull requests

2 participants