Skip to content

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

DEV: Drop obsolete chat controller specs (#39525)

Jarek Radosz8edf414929bb
diff --git a/plugins/chat/spec/requests/chat/api/channel_messages_controller_spec.rb b/plugins/chat/spec/requests/chat/api/channel_messages_controller_spec.rb
index fd4b0c27ac6..123782ec4ab 100644
--- a/plugins/chat/spec/requests/chat/api/channel_messages_controller_spec.rb
+++ b/plugins/chat/spec/requests/chat/api/channel_messages_controller_spec.rb
@@ -225,6 +225,19 @@ RSpec.describe Chat::Api::ChannelMessagesController do
end
end
+ context "when current user is silenced" do
+ before { UserSilencer.new(current_user).silence }
+
+ it "returns a 422" do
+ put "/chat/api/channels/#{channel.id}/messages/#{message_1.id}",
+ params: {
+ message: "abcdefg",
+ }
+
+ expect(response.status).to eq(422)
+ end
+ end
+
context "when message belongs to a different channel" do
fab!(:other_channel, :category_channel)
fab!(:other_message) { Fabricate(:chat_message, chat_channel: other_channel) }
diff --git a/plugins/chat/spec/requests/chat_controller_spec.rb b/plugins/chat/spec/requests/chat_controller_spec.rb
index 6342f9e730d..86cf70c5852 100644
--- a/plugins/chat/spec/requests/chat_controller_spec.rb
+++ b/plugins/chat/spec/requests/chat_controller_spec.rb
@@ -74,52 +74,6 @@ RSpec.describe Chat::ChatController do
end
end
- xdescribe "#edit_message" do
- fab!(:chat_message) { Fabricate(:chat_message, chat_channel: chat_channel, user: user) }
-
- context "when current user is silenced" do
- before do
- UserSilencer.new(user).silence
- sign_in(user)
- end
-
- it "raises an invalid request" do
- put "/chat/#{chat_channel.id}/edit/#{chat_message.id}.json", params: { new_message: "Hi" }
- expect(response.status).to eq(422)
- end
- end
-
- it "errors when a user tries to edit another user's message" do
- sign_in(Fabricate(:user))
-
- put "/chat/#{chat_channel.id}/edit/#{chat_message.id}.json", params: { new_message: "edit!" }
- expect(response.status).to eq(422)
- end
-
- it "errors when staff tries to edit another user's message" do
- sign_in(admin)
- new_message = "Vrroooom cars go fast"
-
- put "/chat/#{chat_channel.id}/edit/#{chat_message.id}.json",
- params: {
- new_message: new_message,
- }
- expect(response.status).to eq(422)
- end
-
- it "allows a user to edit their own messages" do
- sign_in(user)
- new_message = "Wow markvanlan must be a good programmer"
-
- put "/chat/#{chat_channel.id}/edit/#{chat_message.id}.json",
- params: {
- new_message: new_message,
- }
- expect(response.status).to eq(200)
- expect(chat_message.reload.message).to eq(new_message)
- end
- end
-
describe "react" do
fab!(:chat_channel, :category_channel)
fab!(:chat_message) { Fabricate(:chat_message, chat_channel: chat_channel, user: user) }