Sha256: 756b749d15531dfea6dc8113a04b36d4510e341b3a513d4f860f1b47c4a133f8

Contents?: true

Size: 781 Bytes

Versions: 4

Compression:

Stored size: 781 Bytes

Contents

require 'spec_helper'

describe 'A status request with an ActiveRecordCheck', :type => :request do
  before do
    Rapporteur.add_check(Rapporteur::Checks::ActiveRecordCheck)
  end

  subject { get(status_path) ; response }

  context 'with an unerring ActiveRecord connection' do
    it_behaves_like 'a successful status response'
  end

  context 'with a failed ActiveRecord connection' do
    before do
      allow(ActiveRecord::Base.connection).to receive(:execute).
        and_raise(ActiveRecord::ConnectionNotEstablished)
    end

    it_behaves_like 'an erred status response'

    it 'contains a message regarding the database failure' do
      expect(subject).to include_status_error_message(:database, I18n.t('rapporteur.errors.database.unavailable'))
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rapporteur-3.4.0 spec/requests/active_record_check_spec.rb
rapporteur-3.3.0 spec/requests/active_record_check_spec.rb
rapporteur-3.2.0 spec/requests/active_record_check_spec.rb
rapporteur-3.1.0 spec/requests/active_record_check_spec.rb