]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/stdlib/spec/acceptance/bool2num_spec.rb
upgrade to stdlib 4.6.1
[dsa-puppet.git] / 3rdparty / modules / stdlib / spec / acceptance / bool2num_spec.rb
1 #! /usr/bin/env ruby -S rspec
2 require 'spec_helper_acceptance'
3
4 describe 'bool2num function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
5   describe 'success' do
6     ['false', 'f', '0', 'n', 'no'].each do |bool|
7       it "should convert a given boolean, #{bool}, to 0" do
8         pp = <<-EOS
9         $input = "#{bool}"
10         $output = bool2num($input)
11         notify { "$output": }
12         EOS
13
14         apply_manifest(pp, :catch_failures => true) do |r|
15           expect(r.stdout).to match(/Notice: 0/)
16         end
17       end
18     end
19
20     ['true', 't', '1', 'y', 'yes'].each do |bool|
21       it "should convert a given boolean, #{bool}, to 1" do
22         pp = <<-EOS
23         $input = "#{bool}"
24         $output = bool2num($input)
25         notify { "$output": }
26         EOS
27
28         apply_manifest(pp, :catch_failures => true) do |r|
29           expect(r.stdout).to match(/Notice: 1/)
30         end
31       end
32     end
33   end
34 end