Sha256: c48b1f5b527cff32aa343bdf463e0fdfd4be72829c91f13ebcadc21027ecf21e

Contents?: true

Size: 912 Bytes

Versions: 3

Compression:

Stored size: 912 Bytes

Contents

#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../../../spec_helper'

describe Puppet::Parser::AST::Not do
    before :each do
        @scope = Puppet::Parser::Scope.new()
        @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

3 entries across 3 versions & 1 rubygems

Version Path
puppet-0.24.9 spec/unit/parser/ast/not.rb
puppet-0.24.7 spec/unit/parser/ast/not.rb
puppet-0.24.8 spec/unit/parser/ast/not.rb