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.8.7 spec/unit/parser/ast/not_spec.rb
puppet-3.8.7-x86-mingw32 spec/unit/parser/ast/not_spec.rb
puppet-3.8.7-x64-mingw32 spec/unit/parser/ast/not_spec.rb
puppet-3.8.6 spec/unit/parser/ast/not_spec.rb
puppet-3.8.6-x86-mingw32 spec/unit/parser/ast/not_spec.rb
puppet-3.8.6-x64-mingw32 spec/unit/parser/ast/not_spec.rb
puppet-3.8.5 spec/unit/parser/ast/not_spec.rb
puppet-3.8.5-x86-mingw32 spec/unit/parser/ast/not_spec.rb
puppet-3.8.5-x64-mingw32 spec/unit/parser/ast/not_spec.rb
puppet-3.8.4 spec/unit/parser/ast/not_spec.rb
puppet-3.8.4-x86-mingw32 spec/unit/parser/ast/not_spec.rb
puppet-3.8.4-x64-mingw32 spec/unit/parser/ast/not_spec.rb
puppet-3.8.3 spec/unit/parser/ast/not_spec.rb
puppet-3.8.3-x86-mingw32 spec/unit/parser/ast/not_spec.rb
puppet-3.8.3-x64-mingw32 spec/unit/parser/ast/not_spec.rb
puppet-3.8.2 spec/unit/parser/ast/not_spec.rb
puppet-3.8.2-x86-mingw32 spec/unit/parser/ast/not_spec.rb
puppet-3.8.2-x64-mingw32 spec/unit/parser/ast/not_spec.rb
puppet-3.8.1 spec/unit/parser/ast/not_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/parser/ast/not_spec.rb