Skip to content

Cleaning assets before running rspec #155

Answered by altivi
Faq asked this question in Q&A
Discussion options

You must be logged in to vote

If you're using jsbundling-rails instead of webpacker in your Rails application, you can clean the generated assets before running RSpec tests by adding a custom Rake task to your project. Here's how you can do it:

Create a new file called lib/tasks/jsbundling.rake (if the lib/tasks directory doesn't exist, create it).

In the jsbundling.rake file, define a new Rake task to clean the generated assets. Add the following code:

namespace :jsbundling do
  desc "Clean generated assets"
  task :clean do
    `bundle exec rails jsbundling:clean`
  end
end

This task executes the jsbundling:clean task provided by jsbundling-rails using the bundle exec command.

In your rails_helper.rb file, modify th…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Faq
Comment options

Answer selected by Faq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants