<commit_before>require 'stringio'

def silent
  $stdout = StringIO.new
  result = yield
  $stdout = STDOUT
  result
end

spec 'included files are ran' do
  output = %x{./bin/specter spec/examples/files/*.rb}

  assert output, :include?, 'This is an included file.'
  assert output, :include?, 'Running: spec/examples/files/included.rb'
end

spec 'required files are loaded' do
  output = %x{./bin/specter -r spec/examples/files/required.rb spec/examples/files/*.rb}

  assert output, :include?, 'This is a required file.'
end

spec 'required files are not ran' do
  output = %x{./bin/specter -r spec/examples/files/required.rb spec/examples/files/*.rb}

  refute output, :include?, 'Running: spec/examples/files/required.rb'
end

spec 'excluded files are not ran' do
  output = %x{./bin/specter -e spec/examples/files/excluded.rb spec/examples/files/*.rb}

  refute output, :include?, 'This is an excluded file.'
  refute output, :include?, 'Running: spec/examples/files/excluded.rb'
end

spec '#run returns a true value if none of the spec files failed' do
  status = silent do
    specter = Specter.new
    specter.patterns.push 'spec/examples/empty.rb', 'spec/examples/pass.rb'
    specter.run
  end<commit_msg>Meh. Let's move this.<commit_after>require 'stringio'

def silent
  $stdout = StringIO.new
  result = yield
  $stdout = STDOUT
  result
end

spec 'required files are loaded' do
  output = %x{./bin/specter -r spec/examples/files/required.rb spec/examples/files/*.rb}

  assert output, :include?, 'This is a required file.'
end

spec 'required files are not ran' do
  output = %x{./bin/specter -r spec/examples/files/required.rb spec/examples/files/*.rb}

  refute output, :include?, 'Running: spec/examples/files/required.rb'
end

spec 'included files are ran' do
  output = %x{./bin/specter spec/examples/files/*.rb}

  assert output, :include?, 'This is an included file.'
  assert output, :include?, 'Running: spec/examples/files/included.rb'
end

spec 'excluded files are not ran' do
  output = %x{./bin/specter -e spec/examples/files/excluded.rb spec/examples/files/*.rb}

  refute output, :include?, 'This is an excluded file.'
  refute output, :include?, 'Running: spec/examples/files/excluded.rb'
end

spec '#run returns a true value if none of the spec files failed' do
  status = silent do
    specter = Specter.new
    specter.patterns.push 'spec/examples/empty.rb', 'spec/examples/pass.rb'
    specter.run
  end
{'fraction_non_alphanumeric': 0.12931034482758622, 'fraction_numerical': 0.0, 'mean_word_length': 3.7412451361867705, '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': '4844220', 'n_tokens_mistral': 832, 'n_tokens_neox': 794, 'n_words': 248}