Sha256: 1f78bd8e9d5761a373dda59352a4396f91f354fa2e909ae15e74a3ad42d440be

Contents?: true

Size: 1004 Bytes

Versions: 1

Compression:

Stored size: 1004 Bytes

Contents

describe StatusCat::Checkers::Twilio do

  let(:checker) { StatusCat::Checkers::Twilio.new.freeze }

  it_should_behave_like 'a status checker'

  describe '#initialize' do

    it 'tolerates the gem misssing' do
      gem = Object.send(:remove_const, :Twilio)
      expect(checker.status).to eql('twilio-ruby gem is not installed')
      Object.const_set(:Twilio, gem)
    end

    it 'sets the value' do
      expect(checker.value).to eql(StatusCat::Checkers::Twilio.sid)
    end

    context 'pass' do

      it 'passes if it can connect to Twilio' do
        expect(checker.status).to be_nil
      end
    end

    context 'fail' do

      it 'fails if it receives nil' do
        expect(@twilio_messages).to receive(:total).and_return(nil)
        expect(checker.status).to_not be_nil
      end

      it 'fails if there is an exception' do
        expect(@twilio_messages).to receive(:total).and_raise('This is only a test')
        expect(checker.status).to_not be_nil
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
status_cat-5.0.0 spec/lib/status_cat/checkers/twilio_spec.rb