Sha256: 57f437f995901192b470a5216d15a97bf7b402d2ec152af9d5c626a7e5532fb7

Contents?: true

Size: 683 Bytes

Versions: 7

Compression:

Stored size: 683 Bytes

Contents

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

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

  it "should exist" do
    Puppet::Parser::Functions.function("str2bool").should == "function_str2bool"
  end

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

  it "should convert string 'true' to true" do
    result = scope.function_str2bool(["true"])
    result.should(eq(true))
  end

  it "should convert string 'undef' to false" do
    result = scope.function_str2bool(["undef"])
    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/str2bool_spec.rb
service_kiosk-0.5.5 provision/modules/stdlib/spec/unit/puppet/parser/functions/str2bool_spec.rb
service_kiosk-0.5.4 provision/modules/stdlib/spec/unit/puppet/parser/functions/str2bool_spec.rb
service_kiosk-0.5.3 provision/modules/stdlib/spec/unit/puppet/parser/functions/str2bool_spec.rb
service_kiosk-0.5.2 provision/modules/stdlib/spec/unit/puppet/parser/functions/str2bool_spec.rb
service_kiosk-0.5.1 provision/modules/stdlib/spec/unit/puppet/parser/functions/str2bool_spec.rb
service_kiosk-0.5.0 provision/modules/stdlib/spec/unit/puppet/parser/functions/str2bool_spec.rb