Sha256: 52bc53102fa3e1009d2f5d60f87bd9452b7527d58c1992d20c9eb9c5484d0f77

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

require "vagrant-plugin-bundler/config"
require "vagrant-plugin-bundler/errors"

describe VagrantPlugins::PluginBundler::Config do
  let(:config) { described_class.new }

  # Ensure tests are not affected by AWS credential environment variables
  before :each do
    ENV.stub(:[] => nil)
  end

  describe "config.dependencies" do

    context "when nothing specified" do
      before do
        config.finalize!
      end
      it "should be empty" do
        config.dependencies.should be_empty
      end      
    end

    context "when single plugin specified" do
      before do
        config.depend 'foo', '1.0.0'
        config.finalize!
      end
      it "should contain exactly one plugin" do
        config.dependencies.size.should == 1
      end
      it "should contain the specified plugin" do
        config.dependencies.should == { 'foo' => '1.0.0' }
      end
    end

    context "when multiple plugins specified" do
      context "with all different plugins" do
        before do
          config.depend 'foo', '1.0.0'
          config.depend 'bar', '1.1.0'
          config.finalize!
        end
        it "should contain all specified plugins" do
          config.dependencies.should == { 'foo' => '1.0.0', 'bar' => '1.1.0' }
        end
      end
      context "with same plugin twice" do
        it "should fail" do
          begin
            config.depend 'foo', '1.0.0'
            config.depend 'foo', '1.1.0'
            fail "it should have raised 'DuplicatePluginDefinitionError'"
          rescue VagrantPlugins::PluginBundler::Errors::DuplicatePluginDefinitionError
            # expected
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-plugin-bundler-0.1.0 spec/vagrant-plugin-bundler/config_spec.rb