<commit_before>require File.join File.dirname(__FILE__), '..', 'test_helper'

class LoaderTest < Test::Unit::TestCase

  def test_should_return_default_config_path
    assert_equal "#{Rails.root}/config/sitemaps.yml", AegisNet::Sitemapper::Loader::CONFIG_FILE
  end

  def test_should_load_default_config
    config = AegisNet::Sitemapper::Loader.load_config
    assert_not_nil config
    assert config.is_a?(HashWithIndifferentAccess), config.inspect
  end

  def test_should_return_proc
    proc_eval = AegisNet::Sitemapper::Loader.proc_loader "Proc.new { 'foo' }"
    assert_equal 'foo', proc_eval

    proc_str = "Proc.new { |a,b| 'foo ' << a << ', bar ' << b}"
    proc_eval = AegisNet::Sitemapper::Loader.proc_loader(proc_str, "hello", "world")
    assert_equal 'foo hello, bar world', proc_eval
  end

end
<commit_msg>Convert existing test into minitest spec<commit_after>require 'test_helper'
require 'minitest/autorun'

describe AegisNet::Sitemapper::Loader do

  it 'returns its default config path' do
    AegisNet::Sitemapper::Loader::CONFIG_FILE.must_equal "#{Rails.root}/config/sitemaps.yml"
  end

  it 'loads the default config' do
    config = AegisNet::Sitemapper::Loader.load_config
    config.wont_be_nil
    config.must_be_kind_of HashWithIndifferentAccess
  end

  it 'returns a proc' do
    proc_eval = AegisNet::Sitemapper::Loader.proc_loader "Proc.new { 'foo' }"
    proc_eval.must_equal 'foo'

    proc_str = "Proc.new { |a,b| 'foo ' << a << ', bar ' << b}"
    proc_eval = AegisNet::Sitemapper::Loader.proc_loader(proc_str, "hello", "world")
    proc_eval.must_equal 'foo hello, bar world'
  end

end

{'fraction_non_alphanumeric': 0.12162162162162163, 'fraction_numerical': 0.0, 'mean_word_length': 4.797153024911032, 'pattern_counts': {'":': 0, '<': 16, '<?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': '7555641', 'n_tokens_mistral': 589, 'n_tokens_neox': 569, 'n_words': 114}