]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/stdlib/spec/acceptance/validate_re_spec.rb
upgrade to stdlib 4.6.1
[dsa-puppet.git] / 3rdparty / modules / stdlib / spec / acceptance / validate_re_spec.rb
1 #! /usr/bin/env ruby -S rspec
2 require 'spec_helper_acceptance'
3
4 describe 'validate_re function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
5   describe 'success' do
6     it 'validates a string' do
7       pp = <<-EOS
8       $one = 'one'
9       $two = '^one$'
10       validate_re($one,$two)
11       EOS
12
13       apply_manifest(pp, :catch_failures => true)
14     end
15     it 'validates an array' do
16       pp = <<-EOS
17       $one = 'one'
18       $two = ['^one$', '^two']
19       validate_re($one,$two)
20       EOS
21
22       apply_manifest(pp, :catch_failures => true)
23     end
24     it 'validates a failed array' do
25       pp = <<-EOS
26       $one = 'one'
27       $two = ['^two$', '^three']
28       validate_re($one,$two)
29       EOS
30
31       apply_manifest(pp, :expect_failures => true)
32     end
33     it 'validates a failed array with a custom error message' do
34       pp = <<-EOS
35       $one = '3.4.3'
36       $two = '^2.7'
37       validate_re($one,$two,"The $puppetversion fact does not match 2.7")
38       EOS
39
40       expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/does not match/)
41     end
42   end
43   describe 'failure' do
44     it 'handles improper number of arguments'
45     it 'handles improper argument types'
46   end
47 end