mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: fix flakey spec in handle_category_udpated (#21488)
This commit is contained in:
parent
dee8c759eb
commit
aab6fb13a0
@ -66,8 +66,6 @@ RSpec.describe Chat::AutoRemove::HandleCategoryUpdated do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "when the category still has category_group records" do
|
context "when the category still has category_group records" do
|
||||||
let(:action) { UserHistory.where(custom_type: "chat_auto_remove_membership").last }
|
|
||||||
|
|
||||||
before do
|
before do
|
||||||
[user_1, user_2, admin_1, admin_2].each do |user|
|
[user_1, user_2, admin_1, admin_2].each do |user|
|
||||||
channel_1.add(user)
|
channel_1.add(user)
|
||||||
@ -142,10 +140,24 @@ RSpec.describe Chat::AutoRemove::HandleCategoryUpdated do
|
|||||||
|
|
||||||
it "logs a staff action" do
|
it "logs a staff action" do
|
||||||
result
|
result
|
||||||
expect(action).to have_attributes(
|
|
||||||
details: "users_removed: 1\nchannel_id: #{channel_2.id}\nevent: category_updated",
|
changes =
|
||||||
acting_user_id: Discourse.system_user.id,
|
UserHistory
|
||||||
custom_type: "chat_auto_remove_membership",
|
.where(custom_type: "chat_auto_remove_membership")
|
||||||
|
.all
|
||||||
|
.map { |uh| uh.slice(:details, :acting_user_id) }
|
||||||
|
|
||||||
|
expect(changes).to match_array(
|
||||||
|
[
|
||||||
|
{
|
||||||
|
details: "users_removed: 1\nchannel_id: #{channel_1.id}\nevent: category_updated",
|
||||||
|
acting_user_id: Discourse.system_user.id,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
details: "users_removed: 1\nchannel_id: #{channel_2.id}\nevent: category_updated",
|
||||||
|
acting_user_id: Discourse.system_user.id,
|
||||||
|
},
|
||||||
|
],
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user