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