Sha256: 89ceee30a183eb18d434f6159b8f144422520a77fb56531966dbea5b3fbb557f

Contents?: true

Size: 923 Bytes

Versions: 4

Compression:

Stored size: 923 Bytes

Contents

#! /usr/bin/env ruby -S rspec
require 'spec_helper'

describe Puppet::Parser::AST::Not do
  before :each do
    node     = Puppet::Node.new('localhost')
    compiler = Puppet::Parser::Compiler.new(node)
    @scope   = Puppet::Parser::Scope.new(compiler)
    @true_ast = Puppet::Parser::AST::Boolean.new( :value => true)
    @false_ast = Puppet::Parser::AST::Boolean.new( :value => false)
  end

  it "should evaluate its child expression" do
    val = stub "val"
    val.expects(:safeevaluate).with(@scope)

    operator = Puppet::Parser::AST::Not.new :value => val
    operator.evaluate(@scope)
  end

  it "should return true for ! false" do
    operator = Puppet::Parser::AST::Not.new :value => @false_ast
    operator.evaluate(@scope).should == true
  end

  it "should return false for ! true" do
    operator = Puppet::Parser::AST::Not.new :value => @true_ast
    operator.evaluate(@scope).should == false
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
puppet-3.0.0.rc8 spec/unit/parser/ast/not_spec.rb
puppet-3.0.0.rc7 spec/unit/parser/ast/not_spec.rb
puppet-3.0.0.rc5 spec/unit/parser/ast/not_spec.rb
puppet-3.0.0.rc4 spec/unit/parser/ast/not_spec.rb