summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser/ast/astarray_spec.rb
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-06-28 16:32:11 -0700
committerMarkus Roberts <Markus@reality.com>2010-06-28 16:32:11 -0700
commit9ceb4540a567b0a9de85af5397df4a292303a9c3 (patch)
tree30d1e1601888381baaaa14bfc5ee7246fd5c78e8 /spec/unit/parser/ast/astarray_spec.rb
parent85638cf427fe9b35d3e3b0fa4ce919c5806c60d3 (diff)
downloadpuppet-9ceb4540a567b0a9de85af5397df4a292303a9c3.tar.gz
puppet-9ceb4540a567b0a9de85af5397df4a292303a9c3.tar.xz
puppet-9ceb4540a567b0a9de85af5397df4a292303a9c3.zip
[#3994-part 2] rename integration tests to *_spec.rb
Some spec files like active_record.rb had names that would confuse the load path and get loaded instead of the intended implentation when the spec was run from the same directory as the file. Author: Matt Robinson <matt@puppetlabs.com> Date: Fri Jun 11 15:29:33 2010 -0700
Diffstat (limited to 'spec/unit/parser/ast/astarray_spec.rb')
-rwxr-xr-xspec/unit/parser/ast/astarray_spec.rb72
1 files changed, 0 insertions, 72 deletions
diff --git a/spec/unit/parser/ast/astarray_spec.rb b/spec/unit/parser/ast/astarray_spec.rb
deleted file mode 100755
index 1791c711c..000000000
--- a/spec/unit/parser/ast/astarray_spec.rb
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env ruby
-
-require File.dirname(__FILE__) + '/../../../spec_helper'
-
-describe Puppet::Parser::AST::ASTArray do
- before :each do
- @scope = Puppet::Parser::Scope.new()
- end
-
- it "should have a [] accessor" do
- array = Puppet::Parser::AST::ASTArray.new :children => []
- array.should respond_to(:[])
- end
-
- it "should evaluate all its children" do
- item1 = stub "item1", :is_a? => true
- item2 = stub "item2", :is_a? => true
-
- item1.expects(:safeevaluate).with(@scope).returns(123)
- item2.expects(:safeevaluate).with(@scope).returns(246)
-
- operator = Puppet::Parser::AST::ASTArray.new :children => [item1,item2]
- operator.evaluate(@scope)
- end
-
- it "should evaluate childrens of type ASTArray" do
- item1 = stub "item1", :is_a? => true
- item2 = stub "item2"
- item2.stubs(:is_a?).with(Puppet::Parser::AST).returns(true)
- item2.stubs(:instance_of?).with(Puppet::Parser::AST::ASTArray).returns(true)
- item2.stubs(:each).yields(item1)
-
- item1.expects(:safeevaluate).with(@scope).returns(123)
-
- operator = Puppet::Parser::AST::ASTArray.new :children => [item2]
- operator.evaluate(@scope).should == [123]
- end
-
- it "should flatten children coming from children ASTArray" do
- item1 = stub "item1", :is_a? => true
- item2 = stub "item2"
- item2.stubs(:is_a?).with(Puppet::Parser::AST).returns(true)
- item2.stubs(:instance_of?).with(Puppet::Parser::AST::ASTArray).returns(true)
- item2.stubs(:each).yields([item1])
-
- item1.expects(:safeevaluate).with(@scope).returns(123)
-
- operator = Puppet::Parser::AST::ASTArray.new :children => [item2]
- operator.evaluate(@scope).should == [123]
- end
-
- it "should not flatten the results of children evaluation" do
- item1 = stub "item1", :is_a? => true
- item2 = stub "item2"
- item2.stubs(:is_a?).with(Puppet::Parser::AST).returns(true)
- item2.stubs(:instance_of?).with(Puppet::Parser::AST::ASTArray).returns(true)
- item2.stubs(:each).yields([item1])
-
- item1.expects(:safeevaluate).with(@scope).returns([123])
-
- operator = Puppet::Parser::AST::ASTArray.new :children => [item2]
- operator.evaluate(@scope).should == [[123]]
- end
-
- it "should return a valid string with to_s" do
- a = stub 'a', :is_a? => true, :to_s => "a"
- b = stub 'b', :is_a? => true, :to_s => "b"
- array = Puppet::Parser::AST::ASTArray.new :children => [a,b]
-
- array.to_s.should == "[a, b]"
- end
-end