Sha256: d5285beb47fbcbe6810f91840f277d193df3593f8103e0794006eb031728509a

Contents?: true

Size: 1.21 KB

Versions: 39

Compression:

Stored size: 1.21 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")
    expect(value).to be_kind_of Object
    expect(value).to 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)
      expect(result.one).to eq(2)
      expect(result.two).to eq(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)
      expect(result.one).to eq(1)
      expect(result.two).to eq(2)
      expect(result.instance_variable_get(:@__bar)).to be_nil
    end
  end
end

Version data entries

39 entries across 32 versions & 8 rubygems

Version Path
vagrant-aws-mkubenka-0.7.2.pre.10 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/vagrant/plugin/v1/config_test.rb
vagrant-aws-mkubenka-0.7.2.pre.9 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/vagrant/plugin/v1/config_test.rb
vagrant-unbundled-1.9.5.1 test/unit/vagrant/plugin/v1/config_test.rb
vagrant-unbundled-1.9.1.1 test/unit/vagrant/plugin/v1/config_test.rb
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/vagrant/plugin/v1/config_test.rb
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/vagrant/plugin/v1/config_test.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/vagrant/plugin/v1/config_test.rb
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/vagrant/plugin/v1/config_test.rb
vagrant-unbundled-1.8.5.2 test/unit/vagrant/plugin/v1/config_test.rb
vagrant-unbundled-1.8.5.1 test/unit/vagrant/plugin/v1/config_test.rb
vagrant-unbundled-1.8.4.2 test/unit/vagrant/plugin/v1/config_test.rb
vagrant-unbundled-1.8.4.1 test/unit/vagrant/plugin/v1/config_test.rb
vagrant-unbundled-1.8.1.2 test/unit/vagrant/plugin/v1/config_test.rb
vagrant-unbundled-1.8.1.1 test/unit/vagrant/plugin/v1/config_test.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-1cf2a8db4ccb/test/unit/vagrant/plugin/v1/config_test.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-b421af58e8b3/test/unit/vagrant/plugin/v1/config_test.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-309e896975d1/test/unit/vagrant/plugin/v1/config_test.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-272fb27e0536/test/unit/vagrant/plugin/v1/config_test.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/bundler/gems/vagrant-1e28f1ac31e7/test/unit/vagrant/plugin/v1/config_test.rb