Skip to content

Commit

Permalink
Fix Sprockets Error on Test Suite
Browse files Browse the repository at this point in the history
When attempting to run the test suite I received the following error:

    Failure/Error: RailsApp::Application.initialize!

    Sprockets::Railtie::ManifestNeededError:
      Expected to find a manifest file in `app/assets/config/manifest.js`
      But did not, please create this file and use it to link any assets that need
      to be rendered by your app:

      Example:
        //= link_tree ../images
        //= link_directory ../javascripts .js
        //= link_directory ../stylesheets .css
      and restart your server
    # ./spec/rails_app/config/environment.rb:5:in `<top (required)>'
    # ./spec/spec_helper.rb:9:in `<top (required)>'
    # ./spec/audited/sweeper_spec.rb:1:in `<top (required)>'

This is reflected on CI with the new versions of Rails failing on the
same error:

    https://travis-ci.org/github/collectiveidea/audited/jobs/686147718

Rather than create a dummy file it seemed best to just remove the
Sprockets dependency. At first I was going to include all the other
Rails libraries listed at:

    https://github.com/rails/rails/blob/master/railties/lib/rails/all.rb

I decided to cut it down further because some of these other support
libraries that we are not using may in the future cause similar issues.
Since they are not relevant to the `audited` gem it seemed good to head
off that issue.

I confirmed only the ActiveRecord support needs to be included as
long as I commented out any config related to the other components
(ActionMailer config in `test.rb`).

With ActionController now gone it seems we don't need the dummy
ApplicationController file anymore.

Finally while cleaning things up it seems we don't need development
and production environments since the test suite always runs in the
test environment.

This may all be cutting too deep. Maybe I can't trim as much with
and older version of Rails that is still supported by the `audited` gem.
If CI informs me of that I can roll back some of these cuts.
  • Loading branch information
Eric Anderson committed May 15, 2020
1 parent 4ad3a9c commit 72da59f
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 60 deletions.
2 changes: 0 additions & 2 deletions spec/rails_app/app/controllers/application_controller.rb

This file was deleted.

2 changes: 1 addition & 1 deletion spec/rails_app/config/application.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'rails/all'
require 'active_record/railtie'

module RailsApp
class Application < Rails::Application
Expand Down
21 changes: 0 additions & 21 deletions spec/rails_app/config/environments/development.rb

This file was deleted.

35 changes: 0 additions & 35 deletions spec/rails_app/config/environments/production.rb

This file was deleted.

2 changes: 1 addition & 1 deletion spec/rails_app/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# config.action_mailer.delivery_method = :test

# Randomize the order test cases are executed.
config.active_support.test_order = :random
Expand Down

0 comments on commit 72da59f

Please sign in to comment.