annotate modules/stdlib/spec/acceptance/member_spec.rb @ 37:addb0ea390a1 puppet-3.6

Update Puppet "stdlib" module
author IBBoard <dev@ibboard.co.uk>
date Sat, 14 Mar 2015 20:09:45 +0000
parents
children c42fb28cff86
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
37
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 #! /usr/bin/env ruby -S rspec
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 require 'spec_helper_acceptance'
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4 describe 'member function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 shared_examples 'item found' do
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 it 'should output correctly' do
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 apply_manifest(pp, :catch_failures => true) do |r|
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 expect(r.stdout).to match(/Notice: output correct/)
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 end
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 end
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 end
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 describe 'success' do
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 it 'members arrays' do
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 pp = <<-EOS
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 $a = ['aaa','bbb','ccc']
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 $b = 'ccc'
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 $c = true
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 $o = member($a,$b)
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 if $o == $c {
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 notify { 'output correct': }
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 }
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22 EOS
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24 apply_manifest(pp, :catch_failures => true) do |r|
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25 expect(r.stdout).to match(/Notice: output correct/)
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 end
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 end
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 describe 'members array of integers' do
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29 it_should_behave_like 'item found' do
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
30 let(:pp) { <<-EOS
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31 if member( [1,2,3,4], 4 ){
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
32 notify { 'output correct': }
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
33 }
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
34 EOS
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
35 }
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
36 end
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
37 end
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
38 describe 'members of mixed array' do
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
39 it_should_behave_like 'item found' do
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
40 let(:pp) { <<-EOS
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
41 if member( ['a','4',3], 'a' ){
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
42 notify { 'output correct': }
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
43 }
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
44 EOS
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
45 }
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
46 end
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
47 end
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
48 it 'members arrays without members'
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
49 end
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
50
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
51 describe 'failure' do
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
52 it 'handles improper argument counts'
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
53 end
addb0ea390a1 Update Puppet "stdlib" module
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
54 end