Sha256: d486c64cbdd84358ecc3b7f597c196b7df5553c32bc7ba80deee58de6164baa9

Contents?: true

Size: 1.9 KB

Versions: 5

Compression:

Stored size: 1.9 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

[Slack::RealTime::Stores::Store, Slack::RealTime::Stores::Starter].each do |store_class|
  RSpec.describe store_class, vcr: { cassette_name: 'web/rtm_connect' } do
    include_context 'connected client', store_class: store_class

    context 'team' do
      it 'sets team data on rtm.connect' do
        expect(client.team.name).to eq 'dblock'
        expect(client.team.domain).to eq 'dblockdotorg'
      end

      it 'team_domain_change' do
        event = Slack::RealTime::Event.new(
          'type' => 'team_domain_change',
          'url' => 'https://my.slack.com',
          'domain' => 'my'
        )
        client.send(:dispatch, event)
        expect(client.team.domain).to eq 'my'
        expect(client.team['url']).to eq 'https://my.slack.com'
      end

      it 'email_domain_changed' do
        event = Slack::RealTime::Event.new(
          'type' => 'email_domain_changed',
          'email_domain' => 'example.com'
        )
        client.send(:dispatch, event)
        expect(client.team.email_domain).to eq 'example.com'
      end

      it 'team_pref_change' do
        event = Slack::RealTime::Event.new(
          'type' => 'team_pref_change',
          'name' => 'invites_only_admins',
          'value' => false
        )
        client.send(:dispatch, event)
        expect(client.team.prefs.invites_only_admins).to be false
      end

      it 'team_rename' do
        event = Slack::RealTime::Event.new(
          'type' => 'team_rename',
          'name' => 'New Team Name Inc.'
        )
        client.send(:dispatch, event)
        expect(client.team.name).to eq 'New Team Name Inc.'
      end

      it 'team_plan_change' do
        event = Slack::RealTime::Event.new(
          'type' => 'team_plan_change',
          'plan' => 'std'
        )
        client.send(:dispatch, event)
        expect(client.team.plan).to eq 'std'
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
slack-ruby-client-2.4.0 spec/slack/real_time/event_handlers/team_spec.rb
slack-ruby-client-2.3.0 spec/slack/real_time/event_handlers/team_spec.rb
slack-ruby-client-2.2.0 spec/slack/real_time/event_handlers/team_spec.rb
slack-ruby-client-2.1.0 spec/slack/real_time/event_handlers/team_spec.rb
slack-ruby-client-2.0.0 spec/slack/real_time/event_handlers/team_spec.rb