<commit_before>$TESTING = true
SANDBOX = "./output/showtime"

require 'rubygems'
require 'showtime'
require 'fileutils'
require 'stringio'

Spec::Runner.configure do |config|

  Thor::Base.shell = Thor::Shell::Basic
  FileUtils.rm_rf(SANDBOX)
  FileUtils.mkdir_p(SANDBOX)
  
  def capture(stream)
    begin
      stream = stream.to_s
      eval "$#{stream} = StringIO.new"
      yield
      result = eval("$#{stream}").string
    ensure
      eval("$#{stream} = #{stream.upcase}")
    end

    result
  end
  
  def sandbox
    SANDBOX
  end
  
  def inside(path)
    FileUtils.cd(path) { yield }
  end
  
end<commit_msg>Reference url on the capture method<commit_after>$TESTING = true
SANDBOX = "./output/showtime"

require 'rubygems'
require 'showtime'
require 'fileutils'
require 'stringio'

Spec::Runner.configure do |config|

  Thor::Base.shell = Thor::Shell::Basic
  FileUtils.rm_rf(SANDBOX)
  FileUtils.mkdir_p(SANDBOX)
  
  # Stealed from http://github.com/wycats/thor/blob/master/spec/spec_helper.rb#L32
  def capture(stream)
    begin
      stream = stream.to_s
      eval "$#{stream} = StringIO.new"
      yield
      result = eval("$#{stream}").string
    ensure
      eval("$#{stream} = #{stream.upcase}")
    end

    result
  end
  
  def sandbox
    SANDBOX
  end
  
  def inside(path)
    FileUtils.cd(path) { yield }
  end
  
end
{'fraction_non_alphanumeric': 0.12843355605048257, 'fraction_numerical': 0.0014847809948032665, 'mean_word_length': 3.084848484848485, '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': '6917486', 'n_tokens_mistral': 500, 'n_tokens_neox': 482, 'n_words': 99}