Sha256: ab0edaa61acb040b786207cf22edc2061b38a97dfa61109837799ea7a8c1b092

Contents?: true

Size: 1.28 KB

Versions: 278

Compression:

Stored size: 1.28 KB

Contents

#! /usr/bin/env ruby
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
      expect(subject.extractexe(['one', 'two'])).to eq('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
          expect(subject.extractexe(command)).to eq(exe)
        end
      end
    end
  end
end

Version data entries

278 entries across 278 versions & 1 rubygems

Version Path
puppet-6.4.0 spec/unit/provider/exec_spec.rb
puppet-6.4.0-x86-mingw32 spec/unit/provider/exec_spec.rb
puppet-6.4.0-x64-mingw32 spec/unit/provider/exec_spec.rb
puppet-6.4.0-universal-darwin spec/unit/provider/exec_spec.rb
puppet-6.0.7 spec/unit/provider/exec_spec.rb
puppet-6.0.7-x86-mingw32 spec/unit/provider/exec_spec.rb
puppet-6.0.7-x64-mingw32 spec/unit/provider/exec_spec.rb
puppet-6.0.7-universal-darwin spec/unit/provider/exec_spec.rb
puppet-5.5.12 spec/unit/provider/exec_spec.rb
puppet-5.5.12-x86-mingw32 spec/unit/provider/exec_spec.rb
puppet-5.5.12-x64-mingw32 spec/unit/provider/exec_spec.rb
puppet-5.5.12-universal-darwin spec/unit/provider/exec_spec.rb
puppet-6.3.0 spec/unit/provider/exec_spec.rb
puppet-6.3.0-x86-mingw32 spec/unit/provider/exec_spec.rb
puppet-6.3.0-x64-mingw32 spec/unit/provider/exec_spec.rb
puppet-6.3.0-universal-darwin spec/unit/provider/exec_spec.rb
puppet-6.2.0 spec/unit/provider/exec_spec.rb
puppet-6.2.0-x86-mingw32 spec/unit/provider/exec_spec.rb
puppet-6.2.0-x64-mingw32 spec/unit/provider/exec_spec.rb
puppet-6.2.0-universal-darwin spec/unit/provider/exec_spec.rb