Sha256: c2dcbec8e568377001b27676d7fe84ca3d3821aaef620123eeb74a38c0c1945c

Contents?: true

Size: 563 Bytes

Versions: 6

Compression:

Stored size: 563 Bytes

Contents

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

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

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

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

  it "should convert an array to a hash" do
    result = scope.function_hash([['a',1,'b',2,'c',3]])
    expect(result).to(eq({'a'=>1,'b'=>2,'c'=>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/hash_spec.rb
puppet-retrospec-0.12.0 spec/fixtures/modules/stdlib/spec/functions/hash_spec.rb
puppet-retrospec-0.11.0 spec/fixtures/modules/stdlib/spec/functions/hash_spec.rb
puppet-retrospec-0.10.0 spec/fixtures/modules/stdlib/spec/functions/hash_spec.rb
puppet-retrospec-0.9.1 spec/fixtures/modules/stdlib/spec/functions/hash_spec.rb
puppet-retrospec-0.9.0 spec/fixtures/modules/stdlib/spec/functions/hash_spec.rb