FIX: correctly syncs current user message in multiple sessions (#20584)

This commit is contained in:
Joffrey JAFFEUX
2023-03-08 17:28:39 +01:00
committed by GitHub
parent 54351e1b8a
commit 4f2dfd3857
2 changed files with 42 additions and 30 deletions

View File

@ -33,6 +33,24 @@ RSpec.describe "Chat channel", type: :system, js: true do
end
end
context "with two sessions opened on same channel" do
it "syncs the messages" do
using_session(:tab_1) do
sign_in(current_user)
chat.visit_channel(channel_1)
end
using_session(:tab_2) do
sign_in(current_user)
chat.visit_channel(channel_1)
end
using_session(:tab_1) { channel.send_message("test_message") }
using_session(:tab_2) { expect(channel).to have_message(text: "test_message") }
end
end
it "allows to edit this message once persisted" do
chat.visit_channel(channel_1)
channel.send_message("aaaaaaaaaaaaaaaaaaaa")