Sha256: ed682e11e1633aa500c9a05881fd2c68899c0cbef60ac98dd6651086960b41e8

Contents?: true

Size: 914 Bytes

Versions: 92

Compression:

Stored size: 914 Bytes

Contents

#! /usr/bin/env ruby
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

92 entries across 92 versions & 2 rubygems

Version Path
puppet-3.4.0 spec/unit/parser/ast/not_spec.rb
puppet-3.4.0.rc2 spec/unit/parser/ast/not_spec.rb
puppet-3.4.0.rc1 spec/unit/parser/ast/not_spec.rb
puppet-3.3.2 spec/unit/parser/ast/not_spec.rb
puppet-3.3.1 spec/unit/parser/ast/not_spec.rb
puppet-3.3.1.rc3 spec/unit/parser/ast/not_spec.rb
puppet-3.3.1.rc2 spec/unit/parser/ast/not_spec.rb
puppet-3.3.1.rc1 spec/unit/parser/ast/not_spec.rb
puppet-3.3.0 spec/unit/parser/ast/not_spec.rb
puppet-3.3.0.rc3 spec/unit/parser/ast/not_spec.rb
puppet-3.3.0.rc2 spec/unit/parser/ast/not_spec.rb
puppet-3.2.4 spec/unit/parser/ast/not_spec.rb
puppet-3.2.3 spec/unit/parser/ast/not_spec.rb
puppet-3.2.3.rc1 spec/unit/parser/ast/not_spec.rb
puppet-3.2.2 spec/unit/parser/ast/not_spec.rb
puppet-3.2.1 spec/unit/parser/ast/not_spec.rb
puppet-3.2.1.rc1 spec/unit/parser/ast/not_spec.rb
puppet-3.2.0.rc2 spec/unit/parser/ast/not_spec.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/spec/unit/parser/ast/not_spec.rb
puppet-3.2.0.rc1 spec/unit/parser/ast/not_spec.rb