Sha256: a38e889ee8ca2ead8eac467503b974e9e2195f1337bda702ef72e16824022697

Contents?: true

Size: 970 Bytes

Versions: 1

Compression:

Stored size: 970 Bytes

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
end

Version data entries

1 entries across 1 versions & 1 rubygems

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