summaryrefslogtreecommitdiff
path: root/spec/unit/puppet/parser/functions/merge_spec.rb
diff options
context:
space:
mode:
authorJeff McCune <jeff@puppetlabs.com>2012-07-23 15:59:52 -0700
committerJeff McCune <jeff@puppetlabs.com>2012-07-23 15:59:52 -0700
commit243c7c2a499697654101af726f1f47d367e41c13 (patch)
tree855d07f105866afbb26f5e093997a7d5f295e408 /spec/unit/puppet/parser/functions/merge_spec.rb
parentcc414a422de0d773a1012ca57f41f15b4d6caf06 (diff)
parenteffdfb845092fbe549c286926ac686aab1746a12 (diff)
downloadpuppet-stdlib-243c7c2a499697654101af726f1f47d367e41c13.tar.gz
puppet-stdlib-243c7c2a499697654101af726f1f47d367e41c13.tar.bz2
Merge branch '2.3.x'
* 2.3.x: (Maint) Don't mock with mocha (Maint) Fix up the get_module_path parser function (Maint) use PuppetlabsSpec::PuppetSeams.parser_scope (2.3.x) (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals} (Maint) use PuppetlabsSpec::PuppetSeams.parser_scope (Maint) Fix interpreter lines Conflicts: spec/spec_helper.rb spec/unit/puppet/parser/functions/get_module_path_spec.rb
Diffstat (limited to 'spec/unit/puppet/parser/functions/merge_spec.rb')
-rw-r--r--spec/unit/puppet/parser/functions/merge_spec.rb31
1 files changed, 7 insertions, 24 deletions
diff --git a/spec/unit/puppet/parser/functions/merge_spec.rb b/spec/unit/puppet/parser/functions/merge_spec.rb
index 71e1869..9e8a619 100644
--- a/spec/unit/puppet/parser/functions/merge_spec.rb
+++ b/spec/unit/puppet/parser/functions/merge_spec.rb
@@ -1,33 +1,18 @@
-require 'puppet'
-require 'mocha'
-describe Puppet::Parser::Functions.function(:merge) do
+#! /usr/bin/env ruby -S rspec
+
+require 'spec_helper'
- # Pulled from Dan's create_resources function
- # TODO - these let statements should be moved somewhere
- # where they can be resued
- let(:compiler) {
- topscope = Puppet::Parser::Scope.new
- # This is necessary so we don't try to use the compiler to discover our parent.
- topscope.parent = nil
- my_scope = Puppet::Parser::Scope.new
- my_scope.compiler = Puppet::Parser::Compiler.new(Puppet::Node.new("floppy", :environment => 'production'))
- my_scope.parent = topscope
- compiler = my_scope.compiler
- }
- let(:scope) {
- scope = Puppet::Parser::Scope.new
- scope.stubs(:environment).returns(Puppet::Node::Environment.new('production'))
- scope
- }
+describe Puppet::Parser::Functions.function(:merge) do
+ let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
describe 'when calling merge from puppet' do
it "should not compile when no arguments are passed" do
Puppet[:code] = 'merge()'
- expect { compiler.compile }.should raise_error(Puppet::ParseError, /wrong number of arguments/)
+ expect { scope.compiler.compile }.should raise_error(Puppet::ParseError, /wrong number of arguments/)
end
it "should not compile when 1 argument is passed" do
Puppet[:code] = "$my_hash={'one' => 1}\nmerge($my_hash)"
- expect { compiler.compile }.should raise_error(Puppet::ParseError, /wrong number of arguments/)
+ expect { scope.compiler.compile }.should raise_error(Puppet::ParseError, /wrong number of arguments/)
end
end
describe 'when calling merge on the scope instance' do
@@ -48,7 +33,5 @@ describe Puppet::Parser::Functions.function(:merge) do
it 'should accept empty hashes' do
scope.function_merge([{},{},{}]).should == {}
end
-
end
-
end