<commit_before>require 'epath'
$root_folder ||= Path.backfind('.[Rakefile]')

# Require wlang
$LOAD_PATH.unshift(($root_folder/:lib).to_s)
require 'wlang'

# RSpec helpers
require 'rspec'
module Helpers
  include WLang
  extend(self)

  def root_folder
    $root_folder
  end

  def spec_folder
    root_folder/:spec
  end

  def fixtures_folder
    spec_folder/:fixtures
  end

  def tpl_path(what)
    what = "#{what}.tpl" if what.is_a?(Symbol)
    fixtures_folder/:templates/what
  end

  def tpl(what)
    tpl_path(what).read
  end

  # Load fixture dialects
  spec_folder.glob("fixtures/dialect/*.rb").each do |f|
    require f.expand_path
  end

  # Install helper methods for templates
  fixtures_folder.glob("templates/*.tpl").each do |f|
    name = f.basename.without_extension
    define_method(:"#{name}_path") do
      fixtures_folder/:templates/f.basename
    end
    define_method(:"#{name}_tpl") do
      send(:"#{name}_path").read
    end
    define_method(:"#{name}_io") do |&b|
      send(:"#{name}_path").open("r") do |io|
        b.call(io)
      end
    end
  end

end
include Helpers

# Configure rspec
RSpec.configure do |c|
  c.include Helpers
  c.filter_run_excluding :hash_ordering => true if RUBY_VERSION < "1.9"
end<commit_msg>Enhance spec_helper filters.<commit_after>require 'epath'
$root_folder ||= Path.backfind('.[Rakefile]')

# Require wlang
$LOAD_PATH.unshift(($root_folder/:lib).to_s)
require 'wlang'

# RSpec helpers
require 'rspec'
module Helpers
  include WLang
  extend(self)

  def root_folder
    $root_folder
  end

  def spec_folder
    root_folder/:spec
  end

  def fixtures_folder
    spec_folder/:fixtures
  end

  def tpl_path(what)
    what = "#{what}.tpl" if what.is_a?(Symbol)
    fixtures_folder/:templates/what
  end

  def tpl(what)
    tpl_path(what).read
  end

  # Load fixture dialects
  spec_folder.glob("fixtures/dialect/*.rb").each do |f|
    require f.expand_path
  end

  # Install helper methods for templates
  fixtures_folder.glob("templates/*.tpl").each do |f|
    name = f.basename.without_extension
    define_method(:"#{name}_path") do
      fixtures_folder/:templates/f.basename
    end
    define_method(:"#{name}_tpl") do
      send(:"#{name}_path").read
    end
    define_method(:"#{name}_io") do |&b|
      send(:"#{name}_path").open("r") do |io|
        b.call(io)
      end
    end
  end

end
include Helpers

# Configure rspec
RSpec.configure do |c|
  c.include Helpers
  c.filter_run_excluding :hash_ordering => (RUBY_VERSION < "1.9")
end
{'fraction_non_alphanumeric': 0.12901945216355698, 'fraction_numerical': 0.0015879317189360857, 'mean_word_length': 3.5161290322580645, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6136850', 'n_tokens_mistral': 928, 'n_tokens_neox': 929, 'n_words': 191}