Chatwoot/spec/channels/room_channel_spec.rb
Sojan Jose 791d90c6b7
chore: Migrate PubSub Token to contact inbox (#3434)
At present, the websocket pubsub tokens are present at the contact objects in chatwoot. A better approach would be to have these tokens at the contact_inbox object instead. This helps chatwoot to deliver the websocket events targetted to the specific widget connection, stop contact events from leaking into other chat sessions from the same contact.

Fixes #1682
Fixes #1664

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
2021-11-22 23:32:17 +05:30

15 lines
402 B
Ruby

require 'rails_helper'
RSpec.describe RoomChannel, type: :channel do
let!(:contact_inbox) { create(:contact_inbox) }
before do
stub_connection
end
it 'subscribes to a stream when pubsub_token is provided' do
subscribe(pubsub_token: contact_inbox.pubsub_token)
expect(subscription).to be_confirmed
expect(subscription).to have_stream_for(contact_inbox.pubsub_token)
end
end