RSpec Request Warning - Rails 5.1 Upgrade - Assets Missing in the Asset Pipeline

I was trying to upgrade my Rails 5.0.1 application to Rails 5.1 and came across some crash warnings. I was able to resolve everything but one.

I've searched a bit and haven't found a definitive answer.

Background

This is an application that has just been completed. I just updated my rails version to 5.1

I have an RSpec spec spec. They check the redirect to (Devise) login. This error appears in these specifications.

The controller specifications are working fine. I see this warning in BOM requests regarding css, js, images, etc.

I have dashboard.js

assets in my pipeline. And there is a file app/assets/javascripts/dashboard.coffee

.

# config/initializers/assets.rb
Rails.application.config.assets.precompile += %w[
  sites.js
  sites.css
  admin.js
  admin.css
  header.js
  dashboard.js
  dashboard.css
  setup.js
  setup.css
]

      

Warning

Here is the warning I see.

DEPRECATION WARNING: The asset "header.js" is not present in the asset pipeline.Falling back to an asset that may be in the public folder.
This behavior is deprecated and will be removed.
To bypass the asset pipeline and preserve this behavior,
use the `skip_pipeline: true` option.
  (called from _app_views_layouts_dashboard_html_slim__2366450786595837886_80483400 at /home/ziyan/Work/Brevica/churchfoyer/app/views/layouts/dashboard.html.slim:17)

DEPRECATION WARNING: The asset "dashboard.js" is not present in the asset pipeline.Falling back to an asset that may be in the public folder.
This behavior is deprecated and will be removed.
To bypass the asset pipeline and preserve this behavior,
use the `skip_pipeline: true` option.
(called from _app_views_layouts_dashboard_html_slim__2366450786595837886_80483400 at /home/ziyan/Work/Brevica/churchfoyer/app/views/layouts/dashboard.html.slim:18)
DEPRECATION WARNING: The asset "dashboard.css" is not present in the asset pipeline.Falling back to an asset that may be in the public folder.
This behavior is deprecated and will be removed.
To bypass the asset pipeline and preserve this behavior,
use the `skip_pipeline: true` option.
  (called from _app_views_layouts_dashboard_html_slim__2366450786595837886_80483400 at /home/ziyan/Work/Brevica/churchfoyer/app/views/layouts/dashboard.html.slim:19)

DEPRECATION WARNING: The asset "logos/logo-white.png" is not present in the asset pipeline.Falling back to an asset that may be in the public folder.
This behavior is deprecated and will be removed.
To bypass the asset pipeline and preserve this behavior,
use the `skip_pipeline: true` option.
  (called from _app_views_layouts_dashboard__sidebar_html_slim___2324799200884164274_84919380 at /home/ziyan/Work/Brevica/churchfoyer/app/views/layouts/dashboard/_sidebar.html.slim:3)

      

What i tried

  • pre-compiling assets manually didn't solve

I appreciate any advice on how to resolve this warning.

I think the asset pipeline has been bypassed for specs.

+4


source to share


2 answers


You need to add dashboard.js

to the file assets.rb

to find out rails that it needs to be precompiled.

#/config/initializers/assets.rb
Rails.application.config.assets.precompile += %w( dashboard.js )

      



Add this line, actually you just need to uncomment it and add the filename.

+2


source


I had the same problem after I updated Rails to 5.1

I am assuming you store some of your assets in a folder ./public



You can move your assets from ./public

to folder ./app/assets

. Or just add a parameter skip_pipeline: true

like:

image_url("body-bg.gif", skip_pipeline: true)

      

0


source







All Articles