FIX: Fix flaky test resulting from PostAlerter keyword arguments (#19826)

We've been doing some work to support new keyword argument semantics in Ruby 3. As part of that we made some changes to `DiscourseEvent::TestHelper`. The backwards compatibility fix doesn't work if the method is called with an empty hash as the final argument. This fix adds a valid option to the final hash in the particular test.
This commit is contained in:
Ted Johansson 2023-01-12 09:46:50 +08:00 committed by GitHub
parent 98d5a0e63c
commit 421fbfd1c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -1053,10 +1053,12 @@ RSpec.describe PostAlerter do
it "triggers :before_create_notification" do
type = Notification.types[:private_message]
events =
DiscourseEvent.track_events { PostAlerter.new.create_notification(user, type, post, {}) }
DiscourseEvent.track_events do
PostAlerter.new.create_notification(user, type, post, { revision_number: 1 })
end
expect(events).to include(
event_name: :before_create_notification,
params: [user, type, post, {}],
params: [user, type, post, { revision_number: 1 }],
)
end
end