Sha256: cd17a91ae72d9b5408637a1d67f2788455e7b862056f915acc8e8e99a6ff611f

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

RSpec.describe Slack::Web::Api::Endpoints::Users do
  let(:client) { Slack::Web::Client.new }

  context 'users' do
    it 'list', vcr: { cassette_name: 'web/users_list' } do
      json = client.users_list(presence: true)
      expect(json.ok).to be true
      expect(json.members.size).to eq 35
      expect(json.members.first.presence).to eq 'away'
    end

    it 'paginated list', vcr: { cassette_name: 'web/paginated_users_list' } do
      members = []
      client.users_list(presence: true, limit: 5) do |json|
        expect(json.ok).to be true
        members.concat json.members
      end
      expect(members.size).to eq 35
    end

    it 'info', vcr: { cassette_name: 'web/users_info' } do
      json = client.users_info(user: '@aws')
      expect(json.user.name).to eq 'aws'
    end

    if defined?(Picky)
      it 'search', vcr: { cassette_name: 'web/users_info' } do
        json = client.users_search(user: 'aws')
        expect(json.ok).to be true
        expect(json.members.size).to eq 1
        expect(json.members.first.name).to eq 'aws'
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
slack-ruby-client-2.4.0 spec/slack/web/api/endpoints/custom_specs/users_spec.rb
slack-ruby-client-2.3.0 spec/slack/web/api/endpoints/custom_specs/users_spec.rb
slack-ruby-client-2.2.0 spec/slack/web/api/endpoints/custom_specs/users_spec.rb
slack-ruby-client-2.1.0 spec/slack/web/api/endpoints/custom_specs/users_spec.rb
slack-ruby-client-2.0.0 spec/slack/web/api/endpoints/custom_specs/users_spec.rb
slack-ruby-client-1.1.0 spec/slack/web/api/endpoints/custom_specs/users_spec.rb
slack-ruby-client-1.0.0 spec/slack/web/api/endpoints/custom_specs/users_spec.rb