<commit_before>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.<EMAIL>:organization/repo.git') })
    end

    context 'with an unerring response' do
      it 'responds with the check\'s messages' do
        expect(subject).to include_status_message('git_repo', 'git<EMAIL>:organization/repo.git')
      end
    end
  end
end<commit_msg>Add additional context tests.<commit_after>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<EMAIL>: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.<EMAIL>: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<EMAIL>: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
{'fraction_non_alphanumeric': 0.09659090909090909, 'fraction_numerical': 0.0, 'mean_word_length': 3.5576470588235294, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1773935', 'n_tokens_mistral': 589, 'n_tokens_neox': 575, 'n_words': 165}