-
Notifications
You must be signed in to change notification settings - Fork 899
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
Querying for PaperTrail::Version in tests despite PaperTrail being disabled #715
Comments
Hi Gracjan. Were you able to determine why? Perhaps your test suite explicitly loads versions. Can you reproduce this using our bug report template?
Well, that's what |
Hello @jaredbeck. Thank you for your response. I simulated this behaviour in a bug report template and it behaves exactly the same. It outputs the following:
As you can see, the PaperTrail::Version Load is triggered after (or during) the rollback. |
Thanks! That's very helpful.
Looks like there is a # Invoked after rollbacks to ensure versions records are not created
# for changes that never actually took place
def clear_rolled_back_versions
send(self.class.versions_association_name).reload
end Basically, it's eagerly reloading the |
Looks like |
Hello,
I have a Rails application with PaperTrail disabled in
config/environment/test.rb
:As expected, this stops _Version_s being created in test environment, but when I look at
test.log
there's still plenty ofPaperTrail::Version Load
s on model creation.I benchmarked my test suite speed before and after removing all
has_paper_trail
s from my app, and the improvement is quite significant.With
has_paper_trail
(median of 3):Without (median of 3):
I assume there is currently no setting to disable PaperTrail entirely in test environment, but could it be implemented?
The text was updated successfully, but these errors were encountered: