Sha256: 0d488e0b73e388f92ee7635d401ba069053cca1b92b3a39c81d3931fcf5d70c8

Contents?: true

Size: 1.28 KB

Versions: 6

Compression:

Stored size: 1.28 KB

Contents

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

describe 'validate_cmd function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
  describe 'success' do
    it 'validates a true command' do
      pp = <<-EOS
      $one = 'foo'
      if $::osfamily == 'windows' {
        $two = 'echo' #shell built-in
      } else {
        $two = '/bin/echo'
      }
      validate_cmd($one,$two)
      EOS

      apply_manifest(pp, :catch_failures => true)
    end
    it 'validates a fail command' do
      pp = <<-EOS
      $one = 'foo'
      if $::osfamily == 'windows' {
        $two = 'C:/aoeu'
      } else {
        $two = '/bin/aoeu'
      }
      validate_cmd($one,$two)
      EOS

      apply_manifest(pp, :expect_failures => true)
    end
    it 'validates a fail command with a custom error message' do
      pp = <<-EOS
      $one = 'foo'
      if $::osfamily == 'windows' {
        $two = 'C:/aoeu'
      } else {
        $two = '/bin/aoeu'
      }
      validate_cmd($one,$two,"aoeu is dvorak")
      EOS

      apply_manifest(pp, :expect_failures => true) do |output|
        expect(output.stderr).to match(/aoeu is dvorak/)
      end
    end
  end
  describe 'failure' do
    it 'handles improper number of arguments'
    it 'handles improper argument types'
  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/validate_cmd_spec.rb
puppet-retrospec-0.12.0 spec/fixtures/modules/stdlib/spec/acceptance/validate_cmd_spec.rb
puppet-retrospec-0.11.0 spec/fixtures/modules/stdlib/spec/acceptance/validate_cmd_spec.rb
puppet-retrospec-0.10.0 spec/fixtures/modules/stdlib/spec/acceptance/validate_cmd_spec.rb
puppet-retrospec-0.9.1 spec/fixtures/modules/stdlib/spec/acceptance/validate_cmd_spec.rb
puppet-retrospec-0.9.0 spec/fixtures/modules/stdlib/spec/acceptance/validate_cmd_spec.rb