Sha256: ea652423c7491e596a73cf51b53445eae96135376b1f2d74ccc236e13916ffe1

Contents?: true

Size: 1.22 KB

Versions: 26

Compression:

Stored size: 1.22 KB

Contents

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).to_not be nil
      expect(im.name).to eq 'beef'
    end
    it 'im_open' do
      im = client.ims['D07519J57']
      expect(im).to_not 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).to_not 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

26 entries across 26 versions & 1 rubygems

Version Path
slack-ruby-client-0.14.4 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.14.3 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.14.2 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.14.1 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.14.0 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.13.1 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.13.0 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.12.0 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.11.1 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.11.0 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.10.0 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.9.1 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.9.0 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.8.1 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.8.0 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.7.9 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.7.8 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.7.7 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.7.6 spec/slack/real_time/event_handlers/im_spec.rb
slack-ruby-client-0.7.5 spec/slack/real_time/event_handlers/im_spec.rb