Sha256: bb18b5c7e2bf042fdf53d5e705b899d7a916416a4ba20439cf87a367c2912502

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aktion_test-0.2.1 spec/aktion_test/spec_helper_spec.rb