Inline keyword arguments passed to have_logged_event#11012
Merged
Conversation
Contributor
Author
|
Noting that I based this branch off the one in #10987 to save myself some merge conflict headaches, so will have to wait 'til that one wraps up before merging. |
71b5c98 to
d815f0a
Compare
Base automatically changed from
aduth-analytics-compact-event-properties
to
main
August 9, 2024 12:24
c7be4cb to
a0fde55
Compare
zachmargolis
approved these changes
Aug 9, 2024
changelog: Internal, Code Quality, Improve readability of automated test analytics assertions
a0fde55 to
3a2aa57
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🛠 Summary of changes
Updates analytics assertions in specs to inline properties passed to
have_logged_event, rather than creating a separate variable to pass.This is a somewhat subjective stylistic preference, though some more objective rationale is included below. It's meant to complement ongoing effort to standardize and refine logging assertions in specs.
Why?
letmemoized variable, which is unnecessary as we usually ought to only assert the expected log result once in most cases, and the variable is not reusedhave_logged_eventinline vs. referenced variablehash_includingmatching assertion, but I'm of the opinion that we should generally always assert exactly what we're expecting, ashash_includingcan often produce false sense of confidence when properties are added in the future without accountability to corresponding spec expectation changes.Identified using a few search patterns in
spec/(usually filtered tospec/controllersandspec/features):have_logged_event\('.+?[^'):]\)(analytics_hash|properties|attributes|result) = \{📜 Testing Plan
Verify tests pass.