Module: ActiveRecord::Tenanted::Testing::ActionCableTestCase

Defined in:
lib/active_record/tenanted/testing.rb

Instance Method Summary collapse

Instance Method Details

#connect(path = ActionCable.server.config.mount_path, **request_params) ⇒ Object



109
110
111
112
113
114
115
116
117
# File 'lib/active_record/tenanted/testing.rb', line 109

def connect(path = ActionCable.server.config.mount_path, **request_params)
  if (klass = ActiveRecord::Tenanted.connection_class) && klass.current_tenant
    env = request_params.fetch(:env, {})
    env["HTTP_HOST"] ||= "#{klass.current_tenant}.example.com"
    request_params[:env] = env
  end

  super
end