<commit_before>RSpec.describe GeocodeAdviserJob do
  let(:job) { GeocodeAdviserJob.new }

  subject(:adviser) { create(:adviser, postcode: postcode) }

  describe '#perform' do
    context 'when the adviser postcode can be geocoded' do
      let(:postcode) { 'EC1N 2TD' }

      subject do
        VCR.use_cassette('postcode-one-result') do
          job.perform(adviser)
        end
      end

      it 'the adviser is geocoded with the coordinates' do
        subject

        expect(adviser.coordinates).to contain_exactly(51.51807, -0.10852)
      end

      it 'schedules the indexing' do
        expect { subject }.to change { ActiveJob::Base.queue_adapter.enqueued_jobs.size }.by(1)
      end
    end

    context 'when adviser postcode cannot be geocoded' do
      let(:postcode) { 'ABC 123' }

      it 'the latitude and longitude are set to nil' do
        VCR.use_cassette('postcode-no-results') do
          job.perform(adviser)

          expect(adviser.coordinates).to contain_exactly(nil, nil)
        end
      end
    end
  end
end
<commit_msg>Makes the language for the geocode adviser job spec consistent.<commit_after>RSpec.describe GeocodeAdviserJob do
  let(:job) { GeocodeAdviserJob.new }

  subject(:adviser) { create(:adviser, postcode: postcode) }

  describe '#perform' do
    context 'when the adviser postcode can be geocoded' do
      let(:postcode) { 'EC1N 2TD' }

      subject do
        VCR.use_cassette('postcode-one-result') do
          job.perform(adviser)
        end
      end

      it 'the adviser is geocoded with the coordinates' do
        subject

        expect(adviser.coordinates).to contain_exactly(51.51807, -0.10852)
      end

      it 'the adviser firm is scheduled for indexing' do
        expect { subject }.to change { ActiveJob::Base.queue_adapter.enqueued_jobs.size }.by(1)
      end
    end

    context 'when the adviser postcode cannot be geocoded' do
      let(:postcode) { 'ABC 123' }

      subject do
        VCR.use_cassette('postcode-no-results') do
          job.perform(adviser)
        end
      end

      it 'the adviser coordinates are set to nil' do
        subject

        expect(adviser.coordinates).to contain_exactly(nil, nil)
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.087248322147651, 'fraction_numerical': 0.017002237136465325, 'mean_word_length': 2.49375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7542046', 'n_tokens_mistral': 768, 'n_tokens_neox': 706, 'n_words': 199}