source: src/puppetcode/environments/test/modules/stdlib/spec/acceptance/any2array_spec.rb@ a250eb4

0.5 app-cordova debian/bullseye debian/jessie
Last change on this file since a250eb4 was 1c22429, checked in by Joachim Langenbach <joachim.langenbach@…>, 10 years ago
  • gnuboat_epd adds the apt repository from gnuboat to install epd-fuse package
  • Property mode set to 100755
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.