Sha256: ba85863325fa51c44491326ac7856202b83c946d6a69bb12a32cac6094f325af

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'

describe 'A status request with a check that modifies messages' do
  subject { get(status_path) ; response }

  context 'creating a message with a lambda' do
    before do
      Rapporteur::Checker.clear
      Rapporteur::Checker.add_check(Proc.new { |checker| checker.add_message('git_repo', 'git@github.com:organization/repo.git') })
    end

    context 'with an unerring response' do
      it_behaves_like 'a successful status response'

      it 'responds with the check\'s messages' do
        expect(subject).to include_status_message('git_repo', 'git@github.com:organization/repo.git')
      end
    end

    context 'with an erring response' do
      before do
        Rapporteur::Checker.add_check(Proc.new { |checker| checker.add_error('failed') })
      end

      it_behaves_like 'an erred status response'

      it 'does not respond with the check\'s messages' do
        expect(subject).not_to include_status_message('git_repo', 'git@github.com:organization/repo.git')
      end
    end

    context 'with no message-modifying checks' do
      before { Rapporteur::Checker.clear }

      it_behaves_like 'a successful status response'

      it 'does not respond with a messages list' do
        expect(JSON.parse(subject.body)).not_to(have_key('messages'))
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rapporteur-1.1.0 spec/requests/messsage_addition_spec.rb