Skip to content

A platform for community discussion. Free, open, simple.

DEV: Don’t provide an array to site settings group lists in specs

Loïc Guitaut93e02069b027
diff --git a/plugins/chat/spec/lib/chat/channel_fetcher_spec.rb b/plugins/chat/spec/lib/chat/channel_fetcher_spec.rb
index 021464c2b33..c509305a88f 100644
--- a/plugins/chat/spec/lib/chat/channel_fetcher_spec.rb
+++ b/plugins/chat/spec/lib/chat/channel_fetcher_spec.rb
@@ -20,7 +20,7 @@ describe Chat::ChannelFetcher do
Chat::UserChatChannelMembership.where(user: user1)
end
- before { SiteSetting.chat_allowed_groups = [chatters] }
+ before { SiteSetting.chat_allowed_groups = chatters }
describe ".structured" do
it "returns open channel only" do
diff --git a/plugins/chat/spec/lib/chat/guardian_extensions_spec.rb b/plugins/chat/spec/lib/chat/guardian_extensions_spec.rb
index 87ea025d789..881b43d8014 100644
--- a/plugins/chat/spec/lib/chat/guardian_extensions_spec.rb
+++ b/plugins/chat/spec/lib/chat/guardian_extensions_spec.rb
@@ -10,7 +10,7 @@ RSpec.describe Chat::GuardianExtensions do
let(:guardian) { Guardian.new(user) }
let(:staff_guardian) { Guardian.new(staff) }
- before { SiteSetting.chat_allowed_groups = [chatters] }
+ before { SiteSetting.chat_allowed_groups = chatters }
describe "#can_chat?" do
context "when the user is not in allowed to chat" do
diff --git a/plugins/chat/spec/lib/chat/message_bookmarkable_spec.rb b/plugins/chat/spec/lib/chat/message_bookmarkable_spec.rb
index 98a866bf699..d75131c6da6 100644
--- a/plugins/chat/spec/lib/chat/message_bookmarkable_spec.rb
+++ b/plugins/chat/spec/lib/chat/message_bookmarkable_spec.rb
@@ -14,7 +14,7 @@ describe Chat::MessageBookmarkable do
before do
register_test_bookmarkable(described_class)
Chat::UserChatChannelMembership.create(chat_channel: channel, user: user, following: true)
- SiteSetting.chat_allowed_groups = [chatters]
+ SiteSetting.chat_allowed_groups = chatters
end
after { DiscoursePluginRegistry.reset_register!(:bookmarkables) }
diff --git a/plugins/chat/spec/lib/chat_sdk/message_spec.rb b/plugins/chat/spec/lib/chat_sdk/message_spec.rb
index a9814c123f7..7eff710851e 100644
--- a/plugins/chat/spec/lib/chat_sdk/message_spec.rb
+++ b/plugins/chat/spec/lib/chat_sdk/message_spec.rb
@@ -60,7 +60,7 @@ describe ChatSDK::Message do
context "when membership is enforced" do
it "works" do
- SiteSetting.chat_allowed_groups = [Group::AUTO_GROUPS[:everyone]]
+ SiteSetting.chat_allowed_groups = Group::AUTO_GROUPS[:everyone]
params[:enforce_membership] = true
params[:guardian] = Fabricate(:user).guardian
@@ -115,7 +115,7 @@ describe ChatSDK::Message do
fab!(:message_1) { Fabricate(:chat_message, message: "first") }
before do
- SiteSetting.chat_allowed_groups = [Group::AUTO_GROUPS[:everyone]]
+ SiteSetting.chat_allowed_groups = Group::AUTO_GROUPS[:everyone]
message_1.chat_channel.add(message_1.user)
message_1.update!(streaming: true)
end
diff --git a/plugins/chat/spec/requests/chat/api/channels_messages_flags_controller_spec.rb b/plugins/chat/spec/requests/chat/api/channels_messages_flags_controller_spec.rb
index 43609d14f1d..5342ccc347e 100644
--- a/plugins/chat/spec/requests/chat/api/channels_messages_flags_controller_spec.rb
+++ b/plugins/chat/spec/requests/chat/api/channels_messages_flags_controller_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe Chat::Api::ChannelsMessagesFlagsController do
before do
SiteSetting.chat_enabled = true
SiteSetting.chat_allowed_groups = Group::AUTO_GROUPS[:everyone]
- SiteSetting.chat_message_flag_allowed_groups = [Group::AUTO_GROUPS[:everyone]]
+ SiteSetting.chat_message_flag_allowed_groups = Group::AUTO_GROUPS[:everyone]
sign_in(current_user)
end
diff --git a/plugins/chat/spec/requests/core_ext/bookmarks_controller_spec.rb b/plugins/chat/spec/requests/core_ext/bookmarks_controller_spec.rb
index c4d35355b31..1a4a0631ceb 100644
--- a/plugins/chat/spec/requests/core_ext/bookmarks_controller_spec.rb
+++ b/plugins/chat/spec/requests/core_ext/bookmarks_controller_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe BookmarksController do
before do
register_test_bookmarkable(Chat::MessageBookmarkable)
- SiteSetting.chat_allowed_groups = [chatters]
+ SiteSetting.chat_allowed_groups = chatters
sign_in(current_user)
end
diff --git a/plugins/chat/spec/requests/core_ext/notifications_controller_spec.rb b/plugins/chat/spec/requests/core_ext/notifications_controller_spec.rb
index ecd9bfa1238..97442b9622f 100644
--- a/plugins/chat/spec/requests/core_ext/notifications_controller_spec.rb
+++ b/plugins/chat/spec/requests/core_ext/notifications_controller_spec.rb
@@ -13,7 +13,7 @@ RSpec.describe NotificationsController do
before do
Jobs.run_immediately!
SiteSetting.chat_enabled = true
- SiteSetting.chat_allowed_groups = [chatters.id]
+ SiteSetting.chat_allowed_groups = chatters.id
sign_in(user)
end
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 470f06104c0..693cfa875bc 100644
--- a/plugins/chat/spec/requests/core_ext/users_controller_spec.rb
+++ b/plugins/chat/spec/requests/core_ext/users_controller_spec.rb
@@ -31,7 +31,7 @@ describe UsersController do
before do
register_test_bookmarkable(Chat::MessageBookmarkable)
- SiteSetting.chat_allowed_groups = [chatters]
+ SiteSetting.chat_allowed_groups = chatters
sign_in(current_user)
end
diff --git a/plugins/chat/spec/services/auto_remove/handle_user_removed_from_group_spec.rb b/plugins/chat/spec/services/auto_remove/handle_user_removed_from_group_spec.rb
index 2c904bcf3d0..387d4a166d0 100644
--- a/plugins/chat/spec/services/auto_remove/handle_user_removed_from_group_spec.rb
+++ b/plugins/chat/spec/services/auto_remove/handle_user_removed_from_group_spec.rb
@@ -143,7 +143,7 @@ RSpec.describe Chat::AutoRemove::HandleUserRemovedFromGroup do
before do
group_1.add(removed_user)
group_2.add(removed_user)
- SiteSetting.chat_allowed_groups = group_1.id.to_s + "|" + group_2.id.to_s
+ SiteSetting.chat_allowed_groups = [group_1.id, group_2.id].join("|")
CategoryGroup.create(
category: private_category,
group: group_2,
diff --git a/plugins/chat/spec/services/chat/create_message_spec.rb b/plugins/chat/spec/services/chat/create_message_spec.rb
index 5ed68b2e221..3e7f666a962 100644
--- a/plugins/chat/spec/services/chat/create_message_spec.rb
+++ b/plugins/chat/spec/services/chat/create_message_spec.rb
@@ -244,7 +244,7 @@ RSpec.describe Chat::CreateMessage do
fab!(:user) { Fabricate(:user) }
before do
- SiteSetting.chat_allowed_groups = [Group::AUTO_GROUPS[:everyone]]
+ SiteSetting.chat_allowed_groups = Group::AUTO_GROUPS[:everyone]
params[:enforce_membership] = true
end
diff --git a/plugins/chat/spec/services/chat/invite_users_to_channel_spec.rb b/plugins/chat/spec/services/chat/invite_users_to_channel_spec.rb
index 0d0dafdcbae..6e9a8c7e03b 100644
--- a/plugins/chat/spec/services/chat/invite_users_to_channel_spec.rb
+++ b/plugins/chat/spec/services/chat/invite_users_to_channel_spec.rb
@@ -25,7 +25,7 @@ RSpec.describe Chat::InviteUsersToChannel do
before do
group_1.add(user_1)
- SiteSetting.chat_allowed_groups = [group_1].map(&:id).join("|")
+ SiteSetting.chat_allowed_groups = group_1.id
end
context "when all steps pass" do
diff --git a/plugins/chat/spec/services/chat/stop_message_streaming_spec.rb b/plugins/chat/spec/services/chat/stop_message_streaming_spec.rb
index 2a006a88235..e4b6058907b 100644
--- a/plugins/chat/spec/services/chat/stop_message_streaming_spec.rb
+++ b/plugins/chat/spec/services/chat/stop_message_streaming_spec.rb
@@ -13,7 +13,7 @@ RSpec.describe Chat::StopMessageStreaming do
before do
channel_1.add(current_user)
- SiteSetting.chat_allowed_groups = [Group::AUTO_GROUPS[:everyone]]
+ SiteSetting.chat_allowed_groups = Group::AUTO_GROUPS[:everyone]
end
context "with valid params" do
diff --git a/plugins/chat/spec/services/chat/update_user_channel_last_read_spec.rb b/plugins/chat/spec/services/chat/update_user_channel_last_read_spec.rb
index 9122305685a..e3b045fc8c6 100644
--- a/plugins/chat/spec/services/chat/update_user_channel_last_read_spec.rb
+++ b/plugins/chat/spec/services/chat/update_user_channel_last_read_spec.rb
@@ -20,7 +20,7 @@ RSpec.describe Chat::UpdateUserChannelLastRead do
let(:guardian) { Guardian.new(current_user) }
let(:params) { { guardian: guardian, channel_id: channel.id, message_id: message_1.id } }
- before { SiteSetting.chat_allowed_groups = [chatters] }
+ before { SiteSetting.chat_allowed_groups = chatters }
context "when params are not valid" do
before { params.delete(:message_id) }
diff --git a/plugins/chat/spec/services/chat/update_user_thread_last_read_spec.rb b/plugins/chat/spec/services/chat/update_user_thread_last_read_spec.rb
index 5802478dd60..f7251a16b04 100644
--- a/plugins/chat/spec/services/chat/update_user_thread_last_read_spec.rb
+++ b/plugins/chat/spec/services/chat/update_user_thread_last_read_spec.rb
@@ -26,7 +26,7 @@ RSpec.describe Chat::UpdateUserThreadLastRead do
before do
thread.add(current_user)
- SiteSetting.chat_allowed_groups = [chatters]
+ SiteSetting.chat_allowed_groups = chatters
end
context "when params are not valid" do