source: other-projects/hathitrust/vagrant-solr-cluster/trunk/modules/stdlib/spec/functions/type3x_spec.rb@ 30960

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

Switch to using Puppet to provision machine. Strongly based on files developed for spark-hdfs cluster

File size: 1.1 KB
Line 
1require 'spec_helper'
2
3describe 'type3x' do
4 it "should exist" do
5 expect(Puppet::Parser::Functions.function("type3x")).to eq("function_type3x")
6 end
7
8 it "should raise a ParseError if there is less than 1 arguments" do
9 expect { scope.function_type3x([]) }.to( raise_error(Puppet::ParseError))
10 end
11
12 it "should return string when given a string" do
13 result = scope.function_type3x(["aaabbbbcccc"])
14 expect(result).to(eq('string'))
15 end
16
17 it "should return array when given an array" do
18 result = scope.function_type3x([["aaabbbbcccc","asdf"]])
19 expect(result).to(eq('array'))
20 end
21
22 it "should return hash when given a hash" do
23 result = scope.function_type3x([{"a"=>1,"b"=>2}])
24 expect(result).to(eq('hash'))
25 end
26
27 it "should return integer when given an integer" do
28 result = scope.function_type3x(["1"])
29 expect(result).to(eq('integer'))
30 end
31
32 it "should return float when given a float" do
33 result = scope.function_type3x(["1.34"])
34 expect(result).to(eq('float'))
35 end
36
37 it "should return boolean when given a boolean" do
38 result = scope.function_type3x([true])
39 expect(result).to(eq('boolean'))
40 end
41end
Note: See TracBrowser for help on using the repository browser.