Sha256: 172e9f22baed454fdbd9f5a34b236e4bfe056dbf556b406282c7d6d05e2dda31

Contents?: true

Size: 1.28 KB

Versions: 4

Compression:

Stored size: 1.28 KB

Contents

#! /usr/bin/env ruby -S rspec
require 'spec_helper'
require 'puppet/provider/exec'

describe Puppet::Provider::Exec do
  describe "#extractexe" do
    it "should return the first element of an array" do
      subject.extractexe(['one', 'two']).should == 'one'
    end

    {
      # double-quoted commands
      %q{"/has whitespace"}            => "/has whitespace",
      %q{"/no/whitespace"}             => "/no/whitespace",
      # singe-quoted commands
      %q{'/has whitespace'}            => "/has whitespace",
      %q{'/no/whitespace'}             => "/no/whitespace",
      # combinations
      %q{"'/has whitespace'"}          => "'/has whitespace'",
      %q{'"/has whitespace"'}          => '"/has whitespace"',
      %q{"/has 'special' characters"}  => "/has 'special' characters",
      %q{'/has "special" characters'}  => '/has "special" characters',
      # whitespace split commands
      %q{/has whitespace}              => "/has",
      %q{/no/whitespace}               => "/no/whitespace",
    }.each do |base_command, exe|
      ['', ' and args', ' "and args"', " 'and args'"].each do |args|
        command = base_command + args
        it "should extract #{exe.inspect} from #{command.inspect}" do
          subject.extractexe(command).should == exe
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
puppet-3.0.0.rc8 spec/unit/provider/exec_spec.rb
puppet-3.0.0.rc7 spec/unit/provider/exec_spec.rb
puppet-3.0.0.rc5 spec/unit/provider/exec_spec.rb
puppet-3.0.0.rc4 spec/unit/provider/exec_spec.rb