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

Last change on this file since 30903 was 30903, checked in by davidb, 8 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 
1#! /usr/bin/env ruby -S rspec
2require 'spec_helper_acceptance'
3
4describe 'any2array function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
5 describe 'success' do
6 it 'should create an empty array' do
7 pp = <<-EOS
8 $input = ''
9 $output = any2array($input)
10 validate_array($output)
11 notify { "Output: ${output}": }
12 EOS
13
14 apply_manifest(pp, :catch_failures => true) do |r|
15 expect(r.stdout).to match(/Notice: Output: /)
16 end
17 end
18
19 it 'should leave arrays modified' do
20 pp = <<-EOS
21 $input = ['test', 'array']
22 $output = any2array($input)
23 validate_array($output)
24 notify { "Output: ${output}": }
25 EOS
26
27 apply_manifest(pp, :catch_failures => true) do |r|
28 expect(r.stdout).to match(/Notice: Output: (\[|)test(,\s|)array(\]|)/)
29 end
30 end
31
32 it 'should turn a hash into an array' do
33 pp = <<-EOS
34 $input = {'test' => 'array'}
35 $output = any2array($input)
36
37 validate_array($output)
38 # Check each element of the array is a plain string.
39 validate_string($output[0])
40 validate_string($output[1])
41 notify { "Output: ${output}": }
42 EOS
43
44 apply_manifest(pp, :catch_failures => true) do |r|
45 expect(r.stdout).to match(/Notice: Output: (\[|)test(,\s|)array(\]|)/)
46 end
47 end
48 end
49end
Note: See TracBrowser for help on using the repository browser.