Sha256: f77f6cc06f4b53190dcde308e3431ef1381a08e1e7d030dc1e3a9a904ac74273

Contents?: true

Size: 1.25 KB

Versions: 6

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/rtm_start' } do
  include_context 'connected client'

  context 'im' do
    it 'sets im data' do
      expect(client.ims.count).to eq 2
    end
    it 'im_created' do
      expect(client.ims['CDEADBEEF']).to be nil
      event = Slack::RealTime::Event.new(
        'type' => 'im_created',
        'channel' => {
          'id' => 'CDEADBEEF',
          'name' => 'beef'
        }
      )
      client.send(:dispatch, event)
      im = client.ims['CDEADBEEF']
      expect(im).not_to be nil
      expect(im.name).to eq 'beef'
    end
    it 'im_open' do
      im = client.ims['D07519J57']
      expect(im).not_to be_nil
      im.is_open = false
      event = Slack::RealTime::Event.new(
        'type' => 'im_open',
        'channel' => 'D07519J57'
      )
      client.send(:dispatch, event)
      expect(im.is_open).to be true
    end
    it 'im_close' do
      im = client.ims['D07519J57']
      expect(im).not_to be_nil
      expect(im.is_open).to be true
      event = Slack::RealTime::Event.new(
        'type' => 'im_close',
        'channel' => 'D07519J57'
      )
      client.send(:dispatch, event)
      expect(im.is_open).to be false
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
slack-ruby-client-0.17.0 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.16.0 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.15.1 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.15.0 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.14.6 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.14.5 spec/slack/real_time/event_handlers/im_spec.rb