Sha256: d966e35810b9424a097dd0c9a8b4f6c00d10151a7f8a01b5e8e3c4d5597ff959

Contents?: true

Size: 1022 Bytes

Versions: 2

Compression:

Stored size: 1022 Bytes

Contents

require 'spec_helper'

describe SlackRubyBot::App do
  def app
    SlackRubyBot::App.new
  end
  it_behaves_like 'a slack ruby bot'
  context 'retries on rtm.start errors' do
    let(:client) { Slack::RealTime::Client.new }
    let(:logger) { subject.send :logger }
    before do
      allow(subject).to receive(:sleep)
      expect(Slack::RealTime::Client).to receive(:new).twice.and_return(client)
      expect(logger).to receive(:error).twice
    end
    it 'migration_in_progress', vcr: { cassette_name: 'migration_in_progress' } do
      expect do
        subject.send :start!
      end.to raise_error Slack::Web::Api::Error, 'unknown'
    end
    [Faraday::Error::ConnectionFailed, Faraday::Error::TimeoutError, Faraday::Error::SSLError].each do |err|
      it "#{err}" do
        expect(client).to receive(:start!) { fail err, 'Faraday' }
        expect(client).to receive(:start!) { fail 'unknown' }
        expect do
          subject.send :start!
        end.to raise_error 'unknown'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slack-ruby-bot-0.4.5 spec/slack-ruby-bot/app_spec.rb
slack-ruby-bot-0.4.4 spec/slack-ruby-bot/app_spec.rb