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

Improve instrumentation tests #49467

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

p8
Copy link
Member

@p8 p8 commented Oct 3, 2023

Don't build AS::Notifications::Event manually, similar to 95b6fbd.
Related to #49442 (comment)

Also assert that options get passed.

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

Comment on lines 607 to 609
subscriber = proc do |_, _, _, _, event_payload|
payload = event_payload
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about:

Suggested change
subscriber = proc do |_, _, _, _, event_payload|
payload = event_payload
end
subscriber = proc do |event|
payload = event.payload
end

Or even:

Suggested change
subscriber = proc do |_, _, _, _, event_payload|
payload = event_payload
end
subscriber = proc { |event| payload = event.payload }

The four ignored block arguments are noisier visually than manually building the event, imo 🤷

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree and had that at first.
Then I saw similar test had this pattern instead.
I'll update those as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry. I didn't notice the example of moving it to a single line, which is even better IMO.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, it's a very minor difference 🙂

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄

Don't build AS::Notifications::Event manually, similar to 95b6fbd
Also assert that options get passed.
@p8 p8 force-pushed the actionpack/notifications-tests2 branch from 942fa59 to 9c96042 Compare October 3, 2023 11:14
@eugeneius eugeneius merged commit 1edf65d into rails:main Oct 3, 2023
4 checks passed
@p8 p8 deleted the actionpack/notifications-tests2 branch October 3, 2023 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants