]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/stdlib/spec/acceptance/validate_string_spec.rb
upgrade to stdlib 4.6.1
[dsa-puppet.git] / 3rdparty / modules / stdlib / spec / acceptance / validate_string_spec.rb
1 #! /usr/bin/env ruby -S rspec
2 require 'spec_helper_acceptance'
3
4 describe 'validate_string function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
5   describe 'success' do
6     it 'validates a single argument' do
7       pp = <<-EOS
8       $one = 'string'
9       validate_string($one)
10       EOS
11
12       apply_manifest(pp, :catch_failures => true)
13     end
14     it 'validates an multiple arguments' do
15       pp = <<-EOS
16       $one = 'string'
17       $two = 'also string'
18       validate_string($one,$two)
19       EOS
20
21       apply_manifest(pp, :catch_failures => true)
22     end
23     it 'validates a non-string' do
24       {
25         %{validate_string({ 'a' => 'hash' })} => "Hash",
26         %{validate_string(['array'])}         => "Array",
27         %{validate_string(false)}             => "FalseClass",
28       }.each do |pp,type|
29         expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/a #{type}/)
30       end
31     end
32   end
33   describe 'failure' do
34     it 'handles improper number of arguments'
35   end
36 end