diff options
Diffstat (limited to 'spec/integration/parser/compiler_spec.rb')
-rwxr-xr-x | spec/integration/parser/compiler_spec.rb | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/spec/integration/parser/compiler_spec.rb b/spec/integration/parser/compiler_spec.rb index ffff4d845..df310ac07 100755 --- a/spec/integration/parser/compiler_spec.rb +++ b/spec/integration/parser/compiler_spec.rb @@ -81,15 +81,23 @@ describe Puppet::Parser::Compiler do Puppet::Parser::Compiler.compile(node).version.should == 2 end - it "should not allow classes inside evaluated conditional constructs" do - Puppet[:code] = <<-PP - if true { - class foo { + ['class', 'define', 'node'].each do |thing| + it "should not allow #{thing} inside evaluated conditional constructs" do + Puppet[:code] = <<-PP + if true { + #{thing} foo { + } + notify { decoy: } } - } - PP + PP - lambda { Puppet::Parser::Compiler.compile(Puppet::Node.new("mynode")) }.should raise_error(Puppet::Error) + begin + Puppet::Parser::Compiler.compile(Puppet::Node.new("mynode")) + raise "compilation should have raised Puppet::Error" + rescue Puppet::Error => e + e.message.should =~ /at line 2/ + end + end end it "should not allow classes inside unevaluated conditional constructs" do |