mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 02:54:41 +08:00
DEV: fix flakey spec (#21515)
Similar fix to the one made in aab6fb13a0
Instead of checking last object, check against all modified objects in no specific order.
This commit is contained in:
@ -29,7 +29,6 @@ RSpec.describe Chat::AutoRemove::HandleChatAllowedGroupsChange do
|
|||||||
|
|
||||||
context "when new_allowed_groups is empty" do
|
context "when new_allowed_groups is empty" do
|
||||||
let(:new_allowed_groups) { "" }
|
let(:new_allowed_groups) { "" }
|
||||||
let(:action) { UserHistory.where(custom_type: "chat_auto_remove_membership").last }
|
|
||||||
|
|
||||||
before do
|
before do
|
||||||
public_channel_1.add(user_1)
|
public_channel_1.add(user_1)
|
||||||
@ -95,11 +94,26 @@ RSpec.describe Chat::AutoRemove::HandleChatAllowedGroupsChange do
|
|||||||
|
|
||||||
it "logs a staff action" do
|
it "logs a staff action" do
|
||||||
result
|
result
|
||||||
expect(action).to have_attributes(
|
|
||||||
details:
|
changes =
|
||||||
"users_removed: 2\nchannel_id: #{public_channel_2.id}\nevent: chat_allowed_groups_changed",
|
UserHistory
|
||||||
acting_user_id: Discourse.system_user.id,
|
.where(custom_type: "chat_auto_remove_membership")
|
||||||
custom_type: "chat_auto_remove_membership",
|
.all
|
||||||
|
.map { |uh| uh.slice(:details, :acting_user_id) }
|
||||||
|
|
||||||
|
expect(changes).to match_array(
|
||||||
|
[
|
||||||
|
{
|
||||||
|
details:
|
||||||
|
"users_removed: 2\nchannel_id: #{public_channel_1.id}\nevent: chat_allowed_groups_changed",
|
||||||
|
acting_user_id: Discourse.system_user.id,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
details:
|
||||||
|
"users_removed: 2\nchannel_id: #{public_channel_2.id}\nevent: chat_allowed_groups_changed",
|
||||||
|
acting_user_id: Discourse.system_user.id,
|
||||||
|
},
|
||||||
|
],
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user