<commit_before>require_relative '../../spec_helper'
require_lib 'reek/errors/config_file_error'
require_lib 'reek/configuration/excluded_paths'

RSpec.describe Reek::Configuration::ExcludedPaths do
  describe '#add' do
    let(:exclusions) { [].extend(described_class) }
    let(:paths) {
      %w[samples/directory_does_not_exist/
         samples/source_with_non_ruby_files/
         samples/**/ignore_me*] }

    let(:expected_exclude_paths) {
      [Pathname('samples/source_with_non_ruby_files/'),
       Pathname('samples/source_with_exclude_paths/ignore_me'),
       Pathname('samples/source_with_exclude_paths/nested/ignore_me_as_well')] }

    it 'adds the given paths as Pathname' do
      exclusions.add(paths)
      expect(exclusions).to eq expected_exclude_paths
    end
  end
end<commit_msg>Fix for #1560 to support Glob patterns in exclude_paths with match_array for rspec<commit_after>require_relative '../../spec_helper'
require_lib 'reek/errors/config_file_error'
require_lib 'reek/configuration/excluded_paths'

RSpec.describe Reek::Configuration::ExcludedPaths do
  describe '#add' do
    let(:exclusions) { [].extend(described_class) }
    let(:paths) {
      %w[samples/directory_does_not_exist/
         samples/source_with_non_ruby_files/
         samples/**/ignore_me*] }

    let(:expected_exclude_paths) {
      [Pathname('samples/source_with_non_ruby_files/'),
       Pathname('samples/source_with_exclude_paths/ignore_me'),
       Pathname('samples/source_with_exclude_paths/nested/ignore_me_as_well')] }

    it 'adds the given paths as Pathname' do
      exclusions.add(paths)
      expect(exclusions).to match_array expected_exclude_paths
    end
  end
end
{'fraction_non_alphanumeric': 0.10722748815165876, 'fraction_numerical': 0.002369668246445498, 'mean_word_length': 4.3280757097791795, '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': '4255666', 'n_tokens_mistral': 553, 'n_tokens_neox': 528, 'n_words': 85}