Sha256: 0e7567fef2239118ec485fe57b9c87bc4fd54cced39dfeaec6f2589436dc2247

Contents?: true

Size: 847 Bytes

Versions: 7

Compression:

Stored size: 847 Bytes

Contents

# frozen_string_literal: true
require 'spec_helper'

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

  context 'without auth', vcr: { cassette_name: 'web/auth_test_error' } do
    it 'fails with an exception' do
      expect { client.auth_test }.to raise_error Slack::Web::Api::Errors::SlackError, 'not_authed'
    end
  end

  context 'with auth', vcr: { cassette_name: 'web/auth_test_success' } do
    it 'succeeds' do
      expect { client.auth_test }.not_to raise_error
    end
  end

  context '429 error', vcr: { cassette_name: 'web/429_error' } do
    it 'fails with an specific exception' do
      client.auth_test
    rescue Slack::Web::Api::Errors::TooManyRequestsError => e
      expect(e.message).to eq('Retry after 3600 seconds')
      expect(e.retry_after).to eq(3600)
    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/auth_spec.rb
slack-ruby-client-2.3.0 spec/slack/web/api/endpoints/custom_specs/auth_spec.rb
slack-ruby-client-2.2.0 spec/slack/web/api/endpoints/custom_specs/auth_spec.rb
slack-ruby-client-2.1.0 spec/slack/web/api/endpoints/custom_specs/auth_spec.rb
slack-ruby-client-2.0.0 spec/slack/web/api/endpoints/custom_specs/auth_spec.rb
slack-ruby-client-1.1.0 spec/slack/web/api/endpoints/custom_specs/auth_spec.rb
slack-ruby-client-1.0.0 spec/slack/web/api/endpoints/custom_specs/auth_spec.rb