Sha256: 9e38bfa14b15bd4ef214e06f9e01158255e58f01aaec908c64e9be10bb71a081

Contents?: true

Size: 805 Bytes

Versions: 7

Compression:

Stored size: 805 Bytes

Contents

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

describe "the is_integer function" do
  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }

  it "should exist" do
    Puppet::Parser::Functions.function("is_integer").should == "function_is_integer"
  end

  it "should raise a ParseError if there is less than 1 arguments" do
    lambda { scope.function_is_integer([]) }.should( raise_error(Puppet::ParseError))
  end

  it "should return true if an integer" do
    result = scope.function_is_integer(["3"])
    result.should(eq(true))
  end

  it "should return false if a float" do
    result = scope.function_is_integer(["3.2"])
    result.should(eq(false))
  end

  it "should return false if a string" do
    result = scope.function_is_integer(["asdf"])
    result.should(eq(false))
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
service_kiosk-0.5.6 provision/modules/stdlib/spec/unit/puppet/parser/functions/is_integer_spec.rb
service_kiosk-0.5.5 provision/modules/stdlib/spec/unit/puppet/parser/functions/is_integer_spec.rb
service_kiosk-0.5.4 provision/modules/stdlib/spec/unit/puppet/parser/functions/is_integer_spec.rb
service_kiosk-0.5.3 provision/modules/stdlib/spec/unit/puppet/parser/functions/is_integer_spec.rb
service_kiosk-0.5.2 provision/modules/stdlib/spec/unit/puppet/parser/functions/is_integer_spec.rb
service_kiosk-0.5.1 provision/modules/stdlib/spec/unit/puppet/parser/functions/is_integer_spec.rb
service_kiosk-0.5.0 provision/modules/stdlib/spec/unit/puppet/parser/functions/is_integer_spec.rb