puppetlabs-stdlib/lib
Jeff McCune 2a28ece233 (maint) Fix getparam() spec failure on MRI 1.8
Without this patch applied we're getting the following spec failure, but
only in the MRI 1.8 matrix cells.

    Failures:

      1) getparam when compared against a resource with params
         Failure/Error: should run.with_params('User[dan]', '').and_return('')
         ArgumentError:
           interning empty string
         # ./vendor/ruby/1.8/gems/puppet-3.0.2/lib/puppet/parser/resource.rb:42:in `intern'
         # ./vendor/ruby/1.8/gems/puppet-3.0.2/lib/puppet/parser/resource.rb:42:in `[]'
         # ./lib/puppet/parser/functions/getparam.rb:29:in `real_function_getparam'
         # ./vendor/ruby/1.8/gems/puppet-3.0.2/lib/puppet/parser/functions.rb:63:in `send'
         # ./vendor/ruby/1.8/gems/puppet-3.0.2/lib/puppet/parser/functions.rb:63:in `function_getparam'
         # ./vendor/ruby/1.8/gems/rspec-puppet-0.1.5/lib/rspec-puppet/matchers/run.rb:8:in `call'
         # ./vendor/ruby/1.8/gems/rspec-puppet-0.1.5/lib/rspec-puppet/matchers/run.rb:8
         # ./vendor/ruby/1.8/gems/rspec-puppet-0.1.5/lib/rspec-puppet/matchers/run.rb:24:in `call'
         # ./vendor/ruby/1.8/gems/rspec-puppet-0.1.5/lib/rspec-puppet/matchers/run.rb:24
         # ./vendor/ruby/1.8/gems/rspec-expectations-2.11.3/lib/rspec/matchers/extensions/instance_eval_with_args.rb:11:in `instance_exec'
         # ./vendor/ruby/1.8/gems/rspec-expectations-2.11.3/lib/rspec/matchers/extensions/instance_eval_with_args.rb:11:in `instance_eval_with_args'
         # ./vendor/ruby/1.8/gems/rspec-expectations-2.11.3/lib/rspec/matchers/matcher.rb:60:in `matches?'
         # ./vendor/ruby/1.8/gems/rspec-expectations-2.11.3/lib/rspec/expectations/handler.rb:9:in `handle_matcher'
         # ./vendor/ruby/1.8/gems/rspec-core-2.11.1/lib/rspec/core/subject.rb:64:in `should'
         # ./spec/functions/getparam_spec.rb:29
         # ./vendor/ruby/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example.rb:113:in `instance_eval'
         # ./vendor/ruby/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example.rb:113:in `run'
         # ./vendor/ruby/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example.rb:253:in `with_around_each_hooks'
         # ./vendor/ruby/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example.rb:110:in `run'
         # ./vendor/ruby/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb:378:in `run_examples'
         # ./vendor/ruby/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb:374:in `map'
         # ./vendor/ruby/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb:374:in `run_examples'
         # ./vendor/ruby/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb:360:in `run'
         # ./vendor/ruby/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb:361:in `run'
         # ./vendor/ruby/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb:361:in `map'
         # ./vendor/ruby/1.8/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb:361:in `run'
         # ./vendor/ruby/1.8/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:28:in `run'
         # ./vendor/ruby/1.8/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:28:in `map'
         # ./vendor/ruby/1.8/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:28:in `run'
         # ./vendor/ruby/1.8/gems/rspec-core-2.11.1/lib/rspec/core/reporter.rb:34:in `report'
         # ./vendor/ruby/1.8/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:25:in `run'
         # ./vendor/ruby/1.8/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in `run'
         # ./vendor/ruby/1.8/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `autorun'
         # ./vendor/ruby/1.8/bin/rspec:23

This patch addresses the problem by explicitly returning an empty string if the
string itself is empty.  This avoids trying to convert an empty string to a
symbol which is the root cause of the problem.
2013-01-14 18:38:27 -08:00
..
facter Revert "Revert "Revert "Revert "Merge branch 'hkenney-ticket/master/2157_remove_facts_dot_d'"""" 2012-10-25 11:29:07 -07:00
puppet (maint) Fix getparam() spec failure on MRI 1.8 2013-01-14 18:38:27 -08:00