Sha256: 12a780b27a320dd3562e50615e868f9a578900af6c8410430d7be9b08db47683

Contents?: true

Size: 661 Bytes

Versions: 6

Compression:

Stored size: 661 Bytes

Contents

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

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

  it "should exist" do
    expect(Puppet::Parser::Functions.function("size")).to eq("function_size")
  end

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

  it "should return the size of a string" do
    result = scope.function_size(["asdf"])
    expect(result).to(eq(4))
  end

  it "should return the size of an array" do
    result = scope.function_size([["a","b","c"]])
    expect(result).to(eq(3))
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
puppet-retrospec-0.12.1 spec/fixtures/modules/stdlib/spec/functions/size_spec.rb
puppet-retrospec-0.12.0 spec/fixtures/modules/stdlib/spec/functions/size_spec.rb
puppet-retrospec-0.11.0 spec/fixtures/modules/stdlib/spec/functions/size_spec.rb
puppet-retrospec-0.10.0 spec/fixtures/modules/stdlib/spec/functions/size_spec.rb
puppet-retrospec-0.9.1 spec/fixtures/modules/stdlib/spec/functions/size_spec.rb
puppet-retrospec-0.9.0 spec/fixtures/modules/stdlib/spec/functions/size_spec.rb