DEV: Remove hardcoded user_id in spec (#21111)

Followup to 08ff6eebad83d921ad0d175aa02332fb04333ff7,
we can just test this using the original problem in
https://meta.discourse.org/t/-/172572, which is that
SiteSetting.default_categories_normal had duplicate
IDs.
This commit is contained in:
Martin Brennan 2023-04-17 16:35:22 +10:00 committed by GitHub
parent 9a15eab3ab
commit a299c61d72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2135,17 +2135,11 @@ RSpec.describe User do
expect(CategoryUser.lookup(user, :regular).pluck(:category_id)).to eq([category4.id]) expect(CategoryUser.lookup(user, :regular).pluck(:category_id)).to eq([category4.id])
end end
it "does not update category preferences if already set by group" do it "does not error on duplicate categories for set_default_categories_preferences" do
user_id = 123 SiteSetting.default_categories_normal = category4.id.to_s + "|" + category4.id.to_s
user = nil
CategoryUser.create!( expect { user = Fabricate(:user, trust_level: 1) }.not_to raise_error
user_id: user_id, expect(CategoryUser.lookup(user, :normal).pluck(:category_id)).to include(category4.id)
category_id: category2.id,
notification_level: CategoryUser.notification_levels[:normal],
)
user = Fabricate(:user, id: user_id, trust_level: 1)
expect(CategoryUser.lookup(user, :normal).pluck(:category_id)).to include(category2.id)
end end
it "does not set category preferences for staged users" do it "does not set category preferences for staged users" do