A Slack Bot that pulls Pixiv information and posts the full image(s) into Slack, with iOS shortcuts.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

31 lines
1022 B

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