<commit_before>require 'spec_helper'

describe AktionTest::SpecHelper do
  subject { described_class.instance }
  before { subject.reset }

  its(:modules) { should be_a Array }
  its(:options) { should be_a Hash }
  its(:scope)   { should be_a Array }
  its(:scope)   { should == %w(AktionTest Module) }

  describe '#within' do
    it 'allows a scope to be added' do
      described_class.within :Test do
        subject.scope.should == %w(AktionTest Module Test)
      end
      subject.scope.should == %w(AktionTest Module)
    end
  end

  describe '#load' do
    before do
      subject.scope.pop(2)
      subject.scope << 'Baz'
    end

    it 'initializes the module' do
      Baz.autoload?(:Bar).should == 'support/test_module'
      described_class.load :Bar
      Baz.autoload?(:Bar).should be_nil
    end

    it 'adds the module to a set of loaded modules' do
      described_class.load :Bar
      subject.modules.should == [Baz::Bar]
    end

    it 'saves options for the module loaded' do
      described_class.load :Bar, :test => :option
      subject.options.should have_key(:Bar)
      subject.options[:Bar].should == {:test => :option}
    end
  end
end<commit_msg>combine tests to deal with loading only happening once<commit_after>require 'spec_helper'

describe AktionTest::SpecHelper do
  subject { described_class.instance }
  before { subject.reset }

  its(:modules) { should be_a Array }
  its(:options) { should be_a Hash }
  its(:scope)   { should be_a Array }
  its(:scope)   { should == %w(AktionTest Module) }

  describe '#within' do
    it 'allows a scope to be added' do
      described_class.within :Test do
        subject.scope.should == %w(AktionTest Module Test)
      end
      subject.scope.should == %w(AktionTest Module)
    end
  end

  describe '#load' do
    it 'initializes the module, adds it to a set of loaded modules, and saves any options' do
      subject.scope.pop(2)
      subject.scope << 'Baz'

      Baz.autoload?(:Bar).should_not be_nil

      described_class.load :Bar, :test => :option

      subject.modules.should == [Baz::Bar]
      Baz.autoload?(:Bar).should be_nil
      subject.options.should have_key(:Bar)
      subject.options[:Bar].should == {:test => :option}
    end
  end
end
{'fraction_non_alphanumeric': 0.11150599733451799, 'fraction_numerical': 0.000888494002665482, 'mean_word_length': 2.9717813051146384, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2348022', 'n_tokens_mistral': 727, 'n_tokens_neox': 704, 'n_words': 203}