<commit_before>require 'spec_helper'

describe InsensitiveSearch do
  subject { described_class.run(path_source) }

  shared_examples 'to return an instance of Array' do |size|
    it 'return an array' do
      expect(subject).to \
          be_a_kind_of(Array)
    end

    it 'return an array of proper size' do
      expect(subject.size).to \
          eq(size)
    end
  end

  describe 'VERSION' do
    it 'has a version number' do
      expect(described_class::VERSION).not_to be nil
    end
  end

  describe '.run' do
    context 'when passed an absolute path' do
      context 'where the directory exists' do
        include_context \
            'absolute path of directory'

        it_behaves_like \
            'to return an instance of Array',
            1
      end

      context 'where the file exists' do<commit_msg>Add spec to check result correctly<commit_after>require 'spec_helper'

describe InsensitiveSearch do
  subject { described_class.run(path_source) }

  shared_examples 'to return an instance of Array' do |size|
    it 'return an array' do
      expect(subject).to \
          be_a_kind_of(Array)
    end

    it 'return an array of proper size' do
      expect(subject.size).to \
          eq(size)
    end

    it 'return the equivalent insensitively' do
      lower_result = subject.map(&:downcase)
      lower_path_source = path_source.downcase

      expect(lower_result).to \
          all(eq(lower_path_source))
    end
  end

  describe 'VERSION' do
    it 'has a version number' do
      expect(described_class::VERSION).not_to be nil
    end
  end

  describe '.run' do
    context 'when passed an absolute path' do
      context 'where the directory exists' do
        include_context \
            'absolute path of directory'

        it_behaves_like \
            'to return an instance of Array',
            1
      end

      context 'where the file exists' do
{'fraction_non_alphanumeric': 0.06806282722513089, 'fraction_numerical': 0.0010471204188481676, 'mean_word_length': 2.3177083333333335, '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': '2346572', 'n_tokens_mistral': 562, 'n_tokens_neox': 538, 'n_words': 189}