Spec for double query runtime increment #39
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a spec around
Lograge::ActiveRecordLogSubscriber#sql
to ensure that when the config optionkeep_default_active_record_log
is set, theActiveRecord::LogSubscriber.runtime
isn't incremented.I tried to keep in style with what was already there, however it may be able to be accomplished in a better way and I'm happy to change if I need to.
Since the
#sql
method is calling bothRails
andActiveRecord
, i just stubbed the constants in abefore
block with doubles. I didn't want to have to load in the entire framework just for the tests, and all I'm really concerned with is that the#runtime=
method isn't called when thekeep_default_active_record_log
is truthy.I added a require to the spec helper for
active_record_log_subscriber
, too. I don't think it's going to add much time at all to the spec startup, but I can move it somewhere else if that's desired.I also targeted the merge to the
issue-37/fix-double-query-runtime
branch directly, since these tests will fail without the fix there.