Commit 9524d752 authored by Felipe Artur's avatar Felipe Artur

Add specs for override

parent 57141bd0
......@@ -8,7 +8,7 @@ module Gitlab
module Patch
module ActionCableSubscriptionAdapterIdentifier
def identifier
@server.config.cable.has_key?(:id) ? @server.config.cable[:id] : "ActionCable-PID-#{$$}" # rubocop:disable Gitlab/ModuleWithInstanceVariables
@server.config.cable.has_key?(:id) ? @server.config.cable[:id] : super # rubocop:disable Gitlab/ModuleWithInstanceVariables
end
end
end
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'ActionCableSubscriptionAdapterIdentifier override' do
describe '#identifier' do
context 'when id key is nil on cable.yml' do
it 'does not override server config id with action cable pid' do
config = {
adapter: 'redis',
url: 'unix:/home/localuser/redis/redis.socket',
channel_prefix: 'test_',
id: nil
}
::ActionCable::Server::Base.config.cable = config
sub = ActionCable.server.pubsub.send(:redis_connection)
expect(sub.connection[:id]).to eq('redis:///home/localuser/redis/redis.socket/0')
expect(ActionCable.server.config.cable[:id]).to be_nil
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment