Sha256: a0b738154870bcd2099704a08d84e94b3a2cc3ff98705b45dcbd8d4c70fe0f5b

Contents?: true

Size: 904 Bytes

Versions: 6

Compression:

Stored size: 904 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

6 entries across 6 versions & 1 rubygems

Version Path
puppet-0.25.5 spec/unit/parser/ast/not.rb
puppet-0.25.4 spec/unit/parser/ast/not.rb
puppet-0.25.3 spec/unit/parser/ast/not.rb
puppet-0.25.2 spec/unit/parser/ast/not.rb
puppet-0.25.1 spec/unit/parser/ast/not.rb
puppet-0.25.0 spec/unit/parser/ast/not.rb