You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to find a way to only have audits on for the specific tests that test audits. Turning audits off for the 95% of other tests will really speed up test suites. I can't quite figure out how to turn this on/off on a file per file or test by test basis though. Has anyone done this in the past?
The text was updated successfully, but these errors were encountered:
If you're using RSpec, you can set your defaults in the rails helper and then override the settings per test:
# rails_helper.rbconfig.before(:all){Audited.auditing_enabled=false}config.after(:all){Audited.auditing_enabled=true}# opt: ensure audits are re-enabled after run
and in your individual tests where you need audits:
It should be possible to do something similar with minitest. A quick search suggests that it doesn't have a before(:all) equivalent, but you could set Audited.auditing_enabled = false in your test environment/config, and then use setup and teardown to enable/disable for individual tests. Minitest does have an after_tests hook which you could use to ensure that auditing is re-enabled after the test suite has run.
I'm trying to find a way to only have audits on for the specific tests that test audits. Turning audits off for the 95% of other tests will really speed up test suites. I can't quite figure out how to turn this on/off on a file per file or test by test basis though. Has anyone done this in the past?
The text was updated successfully, but these errors were encountered: