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

9 years ago
  1. require 'spec_helper'
  2. describe SlackRubyBot::App do
  3. def app
  4. SlackRubyBot::App.new
  5. end
  6. it_behaves_like 'a slack ruby bot'
  7. context 'retries on rtm.start errors' do
  8. let(:client) { Slack::RealTime::Client.new }
  9. let(:logger) { subject.send :logger }
  10. before do
  11. allow(subject).to receive(:sleep)
  12. expect(Slack::RealTime::Client).to receive(:new).twice.and_return(client)
  13. expect(logger).to receive(:error).twice
  14. end
  15. it 'migration_in_progress', vcr: { cassette_name: 'migration_in_progress' } do
  16. expect do
  17. subject.send :start!
  18. end.to raise_error Slack::Web::Api::Error, 'unknown'
  19. end
  20. [Faraday::Error::ConnectionFailed, Faraday::Error::TimeoutError, Faraday::Error::SSLError].each do |err|
  21. it "#{err}" do
  22. expect(client).to receive(:start!) { fail err, 'Faraday' }
  23. expect(client).to receive(:start!) { fail 'unknown' }
  24. expect do
  25. subject.send :start!
  26. end.to raise_error 'unknown'
  27. end
  28. end
  29. end
  30. end