<commit_before>
shared :dir_glob do |cmd|
  describe "Dir.#{cmd}" do
    before(:all) do
      @cwd = Dir.pwd
      Dir.chdir DirSpecs.mock_dir
    end

    after(:all) do
      Dir.chdir @cwd
    end
<commit_msg>Make sure Dir.glob converts non-String patterns.<commit_after>
shared :dir_glob do |cmd|
  describe "Dir.#{cmd}" do
    before(:all) do
      @cwd = Dir.pwd
      Dir.chdir DirSpecs.mock_dir
    end

    after(:all) do
      Dir.chdir @cwd
    end

    it "converts patterns with to_str" do
      obj = mock('file_one.ext')
      obj.should_receive(:to_str).and_return('file_one.ext')

      Dir.send(cmd, obj).should == %w[file_one.ext]
    end

{'fraction_non_alphanumeric': 0.1244309559939302, 'fraction_numerical': 0.0, 'mean_word_length': 2.5675675675675675, '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': '4523755', 'n_tokens_mistral': 249, 'n_tokens_neox': 244, 'n_words': 58}