diff options
author | Henrik Lindberg <henrik.lindberg@cloudsmith.com> | 2014-06-24 23:34:07 +0200 |
---|---|---|
committer | Henrik Lindberg <henrik.lindberg@cloudsmith.com> | 2014-06-24 23:34:07 +0200 |
commit | ed5d7342458424d2e6d87a63c3bcb6898a510ba8 (patch) | |
tree | e41823d660766cd5b6a5e95d703dc74107f5fcda | |
parent | b04c45643bcbf56d412651bae9cfc1181341d07d (diff) | |
download | puppet-ed5d7342458424d2e6d87a63c3bcb6898a510ba8.tar.gz |
(PUP-2831) Make Puppet work with RGen 0.7.0
This updates the Gemfile to use RGen 0.7.0 (optionally).
In RGen 0.7.0 containment now works as specified, if something is
contained more than once, it moves to the last container that contains
it (by removing it as contained from all other containers). This caused
problems in the Function API where the block default Callable type was
reused for all signatures (and thus moved). There were also problems in
tests where the same type instances was contained in multiple locations.
This fixes these to use distinct instances.
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | lib/puppet/functions.rb | 6 | ||||
-rw-r--r-- | spec/unit/pops/binder/injector_spec.rb | 11 |
3 files changed, 12 insertions, 7 deletions
@@ -27,7 +27,7 @@ gem "puppet", :path => File.dirname(__FILE__), :require => false gem "facter", *location_for(ENV['FACTER_LOCATION'] || ['> 1.6', '< 3']) gem "hiera", *location_for(ENV['HIERA_LOCATION'] || '~> 1.0') gem "rake", "10.1.1", :require => false -gem "rgen", "0.6.5", :require => false +gem "rgen", "0.7.0", :require => false group(:development, :test) do gem "rspec", "~> 2.11.0", :require => false diff --git a/lib/puppet/functions.rb b/lib/puppet/functions.rb index de136e7e6..1996d91ff 100644 --- a/lib/puppet/functions.rb +++ b/lib/puppet/functions.rb @@ -288,10 +288,12 @@ module Puppet::Functions def required_block_param(*type_and_name) case type_and_name.size when 0 - type = @all_callables + # the type must be an independent instance since it will be contained in another type + type = @all_callables.copy name = 'block' when 1 - type = @all_callables + # the type must be an independent instance since it will be contained in another type + type = @all_callables.copy name = type_and_name[0] when 2 type_string, name = type_and_name diff --git a/spec/unit/pops/binder/injector_spec.rb b/spec/unit/pops/binder/injector_spec.rb index 32eba3260..3905f92d3 100644 --- a/spec/unit/pops/binder/injector_spec.rb +++ b/spec/unit/pops/binder/injector_spec.rb @@ -101,7 +101,7 @@ describe 'Injector' do let(:bindings) { factory.named_bindings('test') } let(:scope) { null_scope()} - let(:duck_type) { type_factory.ruby(InjectorSpecModule::TestDuck) } +# let(:duck_type) { type_factory.ruby(InjectorSpecModule::TestDuck) } let(:binder) { Puppet::Pops::Binder::Binder } @@ -109,6 +109,9 @@ describe 'Injector' do binder.new(layered_bindings) end + def duck_type + type_factory.ruby(InjectorSpecModule::TestDuck) + end let(:layered_bindings) { factory.layered_bindings(test_layer_with_bindings(bindings.model)) } @@ -592,11 +595,11 @@ describe 'Injector' do it "should fail attempts to append, perform uniq or flatten on type incompatible multibind hash" do hash_of_integer = type_factory.hash_of(type_factory.integer()) ids = ["ducks1", "ducks2", "ducks3"] - mb = bindings.multibind(ids[0]).type(hash_of_integer).name('broken_family0') + mb = bindings.multibind(ids[0]).type(hash_of_integer.copy).name('broken_family0') mb.producer_options(:conflict_resolution => :append) - mb = bindings.multibind(ids[1]).type(hash_of_integer).name('broken_family1') + mb = bindings.multibind(ids[1]).type(hash_of_integer.copy).name('broken_family1') mb.producer_options(:flatten => :true) - mb = bindings.multibind(ids[2]).type(hash_of_integer).name('broken_family2') + mb = bindings.multibind(ids[2]).type(hash_of_integer.copy).name('broken_family2') mb.producer_options(:uniq => :true) injector = injector(binder.new(factory.layered_bindings(test_layer_with_bindings(bindings.model)))) |