DEV: Change Bookmarkable registration to DiscoursePluginRegistry (#20556)

Similar spirit to e195e6f614de7a4c4f151ad947578fb69f8917f0,
this moves the Bookmarkable registration to DiscoursePluginRegistry
so plugins which are not enabled do not register additional
bookmarkable classes.
This commit is contained in:
Martin Brennan
2023-03-08 10:39:12 +10:00
committed by GitHub
parent 1c881c1037
commit 360d0dde65
16 changed files with 43 additions and 46 deletions

View File

@ -12,7 +12,6 @@ RSpec.describe BookmarkQuery do
describe "#list_all" do
before do
Bookmark.reset_bookmarkables
register_test_bookmarkable
Fabricate(:topic_user, user: user, topic: post_bookmark.bookmarkable.topic)
@ -20,14 +19,14 @@ RSpec.describe BookmarkQuery do
user_bookmark
end
after { DiscoursePluginRegistry.reset! }
let(:post_bookmark) { Fabricate(:bookmark, user: user, bookmarkable: Fabricate(:post)) }
let(:topic_bookmark) { Fabricate(:bookmark, user: user, bookmarkable: Fabricate(:topic)) }
let(:user_bookmark) do
Fabricate(:bookmark, user: user, bookmarkable: Fabricate(:user, username: "bookmarkqueen"))
end
after { Bookmark.reset_bookmarkables }
it "returns all the bookmarks for a user" do
expect(bookmark_query.list_all.count).to eq(3)
end
@ -77,9 +76,7 @@ RSpec.describe BookmarkQuery do
)
end
before { Bookmark.reset_bookmarkables }
after { Bookmark.reset_bookmarkables }
after { DiscoursePluginRegistry.reset! }
let(:bookmark3) do
Fabricate(:bookmark, user: user, name: "Check up later", bookmarkable: Fabricate(:post))