Sha256: 83efefc250aec08d56dd56ee966544268ac47556612503d5af25baa2f3235e24

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

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

  context 'creating a message with a block' do
    before do
      Rapporteur.add_check { |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.add_check { |checker| checker.add_error(:base, '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
      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

4 entries across 4 versions & 1 rubygems

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