Sha256: 0ec6f392e930e0ce1de3b4e6bae093b6d9efe5b25ed6cb030ea0fcf744916971

Contents?: true

Size: 790 Bytes

Versions: 3

Compression:

Stored size: 790 Bytes

Contents

require 'spec_helper'

describe 'A status request with an ActiveRecordCheck' do
  before do
    Rapporteur::Checker.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
      ActiveRecord::Base.connection.stub(: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(I18n.t('activemodel.errors.models.rapporteur/checker.attributes.base.database_unavailable'))
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rapporteur-1.1.0 spec/requests/active_record_check_spec.rb
rapporteur-1.0.1 spec/requests/active_record_check_spec.rb
rapporteur-1.0.0 spec/requests/active_record_check_spec.rb