Sha256: c1d9dfd5e88927eb1d71b6e5e550899839789db05041a011b444df5cc125c9e4

Contents?: true

Size: 1002 Bytes

Versions: 19

Compression:

Stored size: 1002 Bytes

Contents

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

require "vagrant/util/scoped_hash_override"

describe Vagrant::Util::ScopedHashOverride do
  let(:klass) do
    Class.new do
      extend Vagrant::Util::ScopedHashOverride
    end
  end

  it "should not mess with non-overrides" do
    original = {
      :key => "value",
      :another_value => "foo"
    }

    klass.scoped_hash_override(original, "foo").should == original
  end

  it "should override if the scope matches" do
    original = {
      :key => "value",
      :scope__key => "replaced"
    }

    expected = {
      :key => "replaced"
    }

    klass.scoped_hash_override(original, "scope").should == expected
  end

  it "should ignore non-matching scopes" do
    original = {
      :key => "value",
      :scope__key => "replaced",
      :another__key => "value"
    }

    expected = {
      :key => "replaced",
      :another__key => "value"
    }

    klass.scoped_hash_override(original, "scope").should == expected
  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/util/scoped_hash_override_test.rb
tamtam-vagrant-reload-1.1.2 vendor/cache/vagrant-0ac2a8738841/test/unit/vagrant/util/scoped_hash_override_test.rb
tamtam-vagrant-reload-1.1.1 vendor/cache/vagrant-0ac2a8738841/test/unit/vagrant/util/scoped_hash_override_test.rb
tamtam-vagrant-reload-1.1 vendor/cache/vagrant-0ac2a8738841/test/unit/vagrant/util/scoped_hash_override_test.rb
tnargav-1.3.6 test/unit/vagrant/util/scoped_hash_override_test.rb
tnargav-1.3.3 test/unit/vagrant/util/scoped_hash_override_test.rb
vagrant-shell-0.2.9 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/test/unit/vagrant/util/scoped_hash_override_test.rb
tnargav-1.2.3 test/unit/vagrant/util/scoped_hash_override_test.rb
vagrant-shell-0.2.8 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/test/unit/vagrant/util/scoped_hash_override_test.rb
vagrant-shell-0.2.6 vendor/bundle/gems/tnargav-1.2.2/test/unit/vagrant/util/scoped_hash_override_test.rb
vagrant-shell-0.2.5 vendor/bundle/gems/tnargav-1.2.2/test/unit/vagrant/util/scoped_hash_override_test.rb
tnargav-1.2.2 test/unit/vagrant/util/scoped_hash_override_test.rb
vagrantup-1.1.3 test/unit/vagrant/util/scoped_hash_override_test.rb
vagrantup-1.1.2 test/unit/vagrant/util/scoped_hash_override_test.rb
vagrantup-1.1.1 test/unit/vagrant/util/scoped_hash_override_test.rb
vagrantup-1.1.0 test/unit/vagrant/util/scoped_hash_override_test.rb
vagrantup-1.1.4 test/unit/vagrant/util/scoped_hash_override_test.rb
vagrant-actionio-0.0.9 vendor/bundle/bundler/gems/vagrant-c74251a1d9c0/test/unit/vagrant/util/scoped_hash_override_test.rb
vagrant-lxc-0.0.1 vendor/vagrant/test/unit/vagrant/util/scoped_hash_override_test.rb