Sha256: 8af4e44a8880af55b4438df9e2655e966e42f4de20bffd3cdf2842a63d145313

Contents?: true

Size: 991 Bytes

Versions: 1

Compression:

Stored size: 991 Bytes

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
      subject.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

Version data entries

1 entries across 1 versions & 1 rubygems

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