From 3044fca9b2819d99b6b352abea55f2edfa88f030 Mon Sep 17 00:00:00 2001 From: Ted Johansson Date: Thu, 12 Jan 2023 09:46:50 +0800 Subject: [PATCH] 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. --- spec/services/post_alerter_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/services/post_alerter_spec.rb b/spec/services/post_alerter_spec.rb index 43d63b46d6d..d35ea6a831a 100644 --- a/spec/services/post_alerter_spec.rb +++ b/spec/services/post_alerter_spec.rb @@ -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