]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/stdlib/spec/acceptance/validate_slength_spec.rb
upgrade to stdlib 4.6.1
[dsa-puppet.git] / 3rdparty / modules / stdlib / spec / acceptance / validate_slength_spec.rb
1 #! /usr/bin/env ruby -S rspec
2 require 'spec_helper_acceptance'
3
4 describe 'validate_slength function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
5   describe 'success' do
6     it 'validates a single string max' do
7       pp = <<-EOS
8       $one = 'discombobulate'
9       $two = 17
10       validate_slength($one,$two)
11       EOS
12
13       apply_manifest(pp, :catch_failures => true)
14     end
15     it 'validates multiple string maxes' do
16       pp = <<-EOS
17       $one = ['discombobulate', 'moo']
18       $two = 17
19       validate_slength($one,$two)
20       EOS
21
22       apply_manifest(pp, :catch_failures => true)
23     end
24     it 'validates min/max of  strings in array' do
25       pp = <<-EOS
26       $one = ['discombobulate', 'moo']
27       $two = 17
28       $three = 3
29       validate_slength($one,$two,$three)
30       EOS
31
32       apply_manifest(pp, :catch_failures => true)
33     end
34     it 'validates a single string max of incorrect length' do
35       pp = <<-EOS
36       $one = 'discombobulate'
37       $two = 1
38       validate_slength($one,$two)
39       EOS
40
41       apply_manifest(pp, :expect_failures => true)
42     end
43     it 'validates multiple string maxes of incorrect length' do
44       pp = <<-EOS
45       $one = ['discombobulate', 'moo']
46       $two = 3
47       validate_slength($one,$two)
48       EOS
49
50       apply_manifest(pp, :expect_failures => true)
51     end
52     it 'validates multiple strings min/maxes of incorrect length' do
53       pp = <<-EOS
54       $one = ['discombobulate', 'moo']
55       $two = 17
56       $three = 10
57       validate_slength($one,$two,$three)
58       EOS
59
60       apply_manifest(pp, :expect_failures => true)
61     end
62   end
63   describe 'failure' do
64     it 'handles improper number of arguments'
65     it 'handles improper first argument type'
66     it 'handles non-strings in array of first argument'
67     it 'handles improper second argument type'
68     it 'handles improper third argument type'
69     it 'handles negative ranges'
70     it 'handles improper ranges'
71   end
72 end