summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/parser/ast/collexpr.rb2
-rwxr-xr-xspec/unit/parser/ast/collexpr.rb6
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/puppet/parser/ast/collexpr.rb b/lib/puppet/parser/ast/collexpr.rb
index 85bca583f..54b003a91 100644
--- a/lib/puppet/parser/ast/collexpr.rb
+++ b/lib/puppet/parser/ast/collexpr.rb
@@ -31,7 +31,7 @@ class CollExpr < AST::Branch
when "and"; code1.call(resource) and code2.call(resource)
when "or"; code1.call(resource) or code2.call(resource)
when "=="
- if resource[str1].is_a?(Array) && form != :exported
+ if resource[str1].is_a?(Array)
resource[str1].include?(str2)
else
resource[str1] == str2
diff --git a/spec/unit/parser/ast/collexpr.rb b/spec/unit/parser/ast/collexpr.rb
index 51cd820a2..e45203492 100755
--- a/spec/unit/parser/ast/collexpr.rb
+++ b/spec/unit/parser/ast/collexpr.rb
@@ -74,16 +74,18 @@ describe Puppet::Parser::AST::CollExpr do
end
end
- it "should check for array member equality if resource parameter is an array for ==" do
+ [:exported,:virtual].each do |mode|
+ it "should check for array member equality if resource parameter is an array for == in mode #{mode}" do
array = mock 'array', :safeevaluate => "array"
test1 = mock 'test1'
test1.expects(:safeevaluate).with(@scope).returns("test1")
resource = mock 'resource'
resource.expects(:[]).with("array").at_least(1).returns(["test1","test2","test3"])
- collexpr = ast::CollExpr.new(:test1 => array, :test2 => test1, :oper => "==")
+ collexpr = ast::CollExpr.new(:test1 => array, :test2 => test1, :oper => "==", :form => mode)
collexpr.evaluate(@scope)[1].call(resource).should be_true
end
+ end
it "should raise an error for invalid operator" do
lambda { collexpr = ast::CollExpr.new(:oper=>">") }.should raise_error