From a8d6dc4d3a5c3d937ff0bb162c93ec628428cda1 Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Fri, 10 Nov 2023 20:16:22 +1000 Subject: [PATCH] DEV: Fix bookmark flaky (#24327) Fixes this problem that happens sometimes in specs: > Mocha::StubbingError: > # was instantiated in one test but it is receiving invocations within another test. This can lead to unintended interactions between tests and hence unexpected test failures. Ensure that every test correctly cleans up any state that it introduces. --- plugins/chat/spec/requests/core_ext/users_controller_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/chat/spec/requests/core_ext/users_controller_spec.rb b/plugins/chat/spec/requests/core_ext/users_controller_spec.rb index b7ff5445fd2..d6cbe07224a 100644 --- a/plugins/chat/spec/requests/core_ext/users_controller_spec.rb +++ b/plugins/chat/spec/requests/core_ext/users_controller_spec.rb @@ -35,6 +35,8 @@ describe UsersController do sign_in(current_user) end + after { DiscoursePluginRegistry.reset_register!(:bookmarkables) } + it "does not return any unread notifications for chat bookmarks that the user no longer has access to" do bookmark_with_reminder = Fabricate(:bookmark, user: current_user, bookmarkable: bookmark_message)