Sha256: dd45286a8bc3fc8ab852591fa041794c494c10194a0d310525dfde04092665b9

Contents?: true

Size: 945 Bytes

Versions: 6

Compression:

Stored size: 945 Bytes

Contents

#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'

describe 'bool2num function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
  describe 'success' do
    ['false', 'f', '0', 'n', 'no'].each do |bool|
      it "should convert a given boolean, #{bool}, to 0" do
        pp = <<-EOS
        $input = "#{bool}"
        $output = bool2num($input)
        notify { "$output": }
        EOS

        apply_manifest(pp, :catch_failures => true) do |r|
          expect(r.stdout).to match(/Notice: 0/)
        end
      end
    end

    ['true', 't', '1', 'y', 'yes'].each do |bool|
      it "should convert a given boolean, #{bool}, to 1" do
        pp = <<-EOS
        $input = "#{bool}"
        $output = bool2num($input)
        notify { "$output": }
        EOS

        apply_manifest(pp, :catch_failures => true) do |r|
          expect(r.stdout).to match(/Notice: 1/)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
puppet-retrospec-0.12.1 spec/fixtures/modules/stdlib/spec/acceptance/bool2num_spec.rb
puppet-retrospec-0.12.0 spec/fixtures/modules/stdlib/spec/acceptance/bool2num_spec.rb
puppet-retrospec-0.11.0 spec/fixtures/modules/stdlib/spec/acceptance/bool2num_spec.rb
puppet-retrospec-0.10.0 spec/fixtures/modules/stdlib/spec/acceptance/bool2num_spec.rb
puppet-retrospec-0.9.1 spec/fixtures/modules/stdlib/spec/acceptance/bool2num_spec.rb
puppet-retrospec-0.9.0 spec/fixtures/modules/stdlib/spec/acceptance/bool2num_spec.rb