Sha256: d9ac178b5f6c003a17333ca388401a19cbab12963162dfba734fb4bc4a119f2d

Contents?: true

Size: 839 Bytes

Versions: 6

Compression:

Stored size: 839 Bytes

Contents

# frozen_string_literal: true
RSpec.shared_context 'connected client' do |opts|
  let(:client) { Slack::RealTime::Client.new(opts || {}) }
  let(:ws) { double(Slack::RealTime::Concurrency::Mock::WebSocket) }
  let(:url) { 'wss://cerberus-xxxx.lb.slack-msgs.com/websocket/uid' }
  let(:socket) { double(Slack::RealTime::Socket, connected?: true) }

  before do
    Slack::RealTime.configure do |config|
      config.concurrency = Slack::RealTime::Concurrency::Mock
      config.store_class = (opts || {})[:store_class] || Slack::RealTime::Stores::Store
    end
    allow(Slack::RealTime::Socket).to(
      receive(:new).with(url, { ping: 30, logger: Slack::Logger.default }).and_return(socket)
    )
    allow(socket).to receive(:start_sync)
    allow(socket).to receive(:connect!)
    allow(ws).to receive(:on)
    client.start!
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
slack-ruby-client-2.4.0 spec/support/real_time/connected_client.rb
slack-ruby-client-2.3.0 spec/support/real_time/connected_client.rb
slack-ruby-client-2.2.0 spec/support/real_time/connected_client.rb
slack-ruby-client-2.1.0 spec/support/real_time/connected_client.rb
slack-ruby-client-2.0.0 spec/support/real_time/connected_client.rb
slack-ruby-client-1.1.0 spec/support/real_time/connected_client.rb