source: other-projects/hathitrust/vagrant-hadoop-cluster/trunk/modules/stdlib/spec/functions/type_spec.rb@ 30903

Last change on this file since 30903 was 30903, checked in by davidb, 7 years ago

Vagrant provisioning files for a 4-node Hadoop cluster. See README.txt for more details

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1require 'spec_helper'
2
3describe 'type' do
4 it "should exist" do
5 expect(Puppet::Parser::Functions.function("type")).to eq("function_type")
6 end
7
8 it "should give a deprecation warning when called" do
9 scope.expects(:warning).with("type() DEPRECATED: This function will cease to function on Puppet 4; please use type3x() before upgrading to puppet 4 for backwards-compatibility, or migrate to the new parser's typing system.")
10 scope.function_type(["aoeu"])
11 end
12
13 it "should return string when given a string" do
14 result = scope.function_type(["aaabbbbcccc"])
15 expect(result).to(eq('string'))
16 end
17
18 it "should return array when given an array" do
19 result = scope.function_type([["aaabbbbcccc","asdf"]])
20 expect(result).to(eq('array'))
21 end
22
23 it "should return hash when given a hash" do
24 result = scope.function_type([{"a"=>1,"b"=>2}])
25 expect(result).to(eq('hash'))
26 end
27
28 it "should return integer when given an integer" do
29 result = scope.function_type(["1"])
30 expect(result).to(eq('integer'))
31 end
32
33 it "should return float when given a float" do
34 result = scope.function_type(["1.34"])
35 expect(result).to(eq('float'))
36 end
37
38 it "should return boolean when given a boolean" do
39 result = scope.function_type([true])
40 expect(result).to(eq('boolean'))
41 end
42end
Note: See TracBrowser for help on using the repository browser.