Sha256: 2f765d0d44d20ff6c741f0e4d81af8f569aa9801ab51bcd451144d4d3c17d401

Contents?: true

Size: 1.18 KB

Versions: 19

Compression:

Stored size: 1.18 KB

Contents

require File.expand_path("../../../../base", __FILE__)

describe Vagrant::Plugin::V1::Config do
  include_context "unit"

  let(:foo_class) do
    Class.new(described_class) do
      attr_accessor :one
      attr_accessor :two
    end
  end

  it "has an UNSET_VALUE constant" do
    value = described_class.const_get("UNSET_VALUE")
    value.should be_kind_of Object
    value.should eql(described_class.const_get("UNSET_VALUE"))
  end

  describe "merging" do
    it "should merge by default by simply copying each instance variable" do
      one = foo_class.new
      one.one = 2
      one.two = 1

      two = foo_class.new
      two.two = 5

      result = one.merge(two)
      result.one.should == 2
      result.two.should == 5
    end

    it "doesn't merge values that start with a double underscore" do
      one = foo_class.new
      one.one = 1
      one.two = 1
      one.instance_variable_set(:@__bar, "one")

      two = foo_class.new
      two.two = 2
      two.instance_variable_set(:@__bar, "two")

      # Merge and verify
      result = one.merge(two)
      result.one.should == 1
      result.two.should == 2
      result.instance_variable_get(:@__bar).should be_nil
    end
  end
end

Version data entries

19 entries across 19 versions & 6 rubygems

Version Path
tamtam-vagrant-reload-1.1.3 vendor/cache/vagrant-0ac2a8738841/test/unit/vagrant/plugin/v1/config_test.rb
tamtam-vagrant-reload-1.1.2 vendor/cache/vagrant-0ac2a8738841/test/unit/vagrant/plugin/v1/config_test.rb
tamtam-vagrant-reload-1.1.1 vendor/cache/vagrant-0ac2a8738841/test/unit/vagrant/plugin/v1/config_test.rb
tamtam-vagrant-reload-1.1 vendor/cache/vagrant-0ac2a8738841/test/unit/vagrant/plugin/v1/config_test.rb
tnargav-1.3.6 test/unit/vagrant/plugin/v1/config_test.rb
tnargav-1.3.3 test/unit/vagrant/plugin/v1/config_test.rb
vagrant-shell-0.2.9 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/test/unit/vagrant/plugin/v1/config_test.rb
tnargav-1.2.3 test/unit/vagrant/plugin/v1/config_test.rb
vagrant-shell-0.2.8 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/test/unit/vagrant/plugin/v1/config_test.rb
vagrant-shell-0.2.6 vendor/bundle/gems/tnargav-1.2.2/test/unit/vagrant/plugin/v1/config_test.rb
vagrant-shell-0.2.5 vendor/bundle/gems/tnargav-1.2.2/test/unit/vagrant/plugin/v1/config_test.rb
tnargav-1.2.2 test/unit/vagrant/plugin/v1/config_test.rb
vagrantup-1.1.3 test/unit/vagrant/plugin/v1/config_test.rb
vagrantup-1.1.2 test/unit/vagrant/plugin/v1/config_test.rb
vagrantup-1.1.1 test/unit/vagrant/plugin/v1/config_test.rb
vagrantup-1.1.0 test/unit/vagrant/plugin/v1/config_test.rb
vagrantup-1.1.4 test/unit/vagrant/plugin/v1/config_test.rb
vagrant-actionio-0.0.9 vendor/bundle/bundler/gems/vagrant-c74251a1d9c0/test/unit/vagrant/plugin/v1/config_test.rb
vagrant-lxc-0.0.1 vendor/vagrant/test/unit/vagrant/plugin/v1/config_test.rb