Sha256: 309f3c01ee62c0478bae93f2aa72f968fd564d6b0729a88554a94dba7212f6e8

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'
require 'pry'

describe Lita::Handlers::RestartElvis, lita_handler: true do
  let(:robot) { Lita::Robot.new(registry) }
  use_vcr_cassette

  subject { described_class.new(robot) }

  before do
    ENV['HEROKU_OAUTH_TOKEN'] ||= 'abcdef'
    ENV['HEROKU_RESTARTABLE_APP_NAME'] ||= 'fake-elvis'
  end

  describe 'routes' do
    it { is_expected.to route('lita restart elvis') }
  end

  describe ':heroku' do
    it 'should connect with our oauth token' do
      expect(PlatformAPI).to receive(:connect_oauth)
      subject.heroku
    end
  end

  describe ':restart_dyno_named' do
    let(:heroku_double) { double }
    let(:dyno_double) { double }

    before { allow(subject).to receive(:heroku) { heroku_double } }
    before { allow(heroku_double).to receive(:dyno) { dyno_double } }

    it 'should ask to restart a dyno' do
      expect(dyno_double).to receive(:restart_all).with('xyz')

      subject.restart_dyno_named('xyz')
    end
  end

  describe 'lita restart elvis' do
    it 'should work' do
      send_message('lita restart elvis')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lita-restart-elvis-0.2.0 spec/lita/handlers/restart_elvis_spec.rb