Sha256: 69a4d25eaeaa7ba2c0bf14e88fe55a3b0b0e007c6bdeb2468c9e2e51ede8b39a

Contents?: true

Size: 831 Bytes

Versions: 6

Compression:

Stored size: 831 Bytes

Contents

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

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

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

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

  it "should return true if passed a hash" do
    result = scope.function_is_hash([{"a"=>1,"b"=>2}])
    expect(result).to(eq(true))
  end

  it "should return false if passed an array" do
    result = scope.function_is_hash([["a","b"]])
    expect(result).to(eq(false))
  end

  it "should return false if passed a string" do
    result = scope.function_is_hash(["asdf"])
    expect(result).to(eq(false))
  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/is_hash_spec.rb
puppet-retrospec-0.12.0 spec/fixtures/modules/stdlib/spec/functions/is_hash_spec.rb
puppet-retrospec-0.11.0 spec/fixtures/modules/stdlib/spec/functions/is_hash_spec.rb
puppet-retrospec-0.10.0 spec/fixtures/modules/stdlib/spec/functions/is_hash_spec.rb
puppet-retrospec-0.9.1 spec/fixtures/modules/stdlib/spec/functions/is_hash_spec.rb
puppet-retrospec-0.9.0 spec/fixtures/modules/stdlib/spec/functions/is_hash_spec.rb