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

own_and_associated_audits for STI #533

Merged
merged 4 commits into from
May 29, 2021
Merged

own_and_associated_audits for STI #533

merged 4 commits into from
May 29, 2021

Conversation

eric-hemasystems
Copy link
Contributor

When own_and_associated_audits was introduced in PR #428 it did not take STI models into account. This PR fixes the problem.

I got an error when trying to run the test suite locally. This error also affects many of the CI builds. 72da59f fixes that issue and although unrelated to my goal is actually most of the changes for this PR. See the commit message for more info.

f5d9899 adds some tests that duplicate the problem and 489224e is the very small change to fix the issue.

Eric Anderson added 3 commits May 15, 2020 11:01
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.
@eric-hemasystems
Copy link
Contributor Author

Looking through the CI results I see:

  • All the Rails 4.2 failed due to the appraisal gem not being compatible. I suggest PR Drop Rails 4.2 support #527 rather than trying to fix it as 4.2 is outside of Rails' own maintenance policy.
  • Rails 6 on PG is failing due to the MigrationContext initializer getting an additional argument for Rails 6. This is probably really considered an internal API for Rails so the audited gem should probably just adapt but this seems outside of the scope of this PR.

@eric-hemasystems
Copy link
Contributor Author

Any feedback on this. Just updated to the latest on master. Would love to get this merged so I don't have to maintain my own branch. 😉

@eric-hemasystems
Copy link
Contributor Author

Looking at CI results I don't see anything related to this PR. Seems CI related.

@danielmorrison danielmorrison merged commit 0d1d9cf into collectiveidea:master May 29, 2021
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

Successfully merging this pull request may close these issues.

2 participants