Sha256: 0bdb49f4daa0f4146b89b22c5831a0da58e1365b861d80bfb7f809d3c28ca9d3

Contents?: true

Size: 1.28 KB

Versions: 19

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

module Beaker
  describe Windows::Exec do
    class WindowsExecTest
      include Windows::Exec

      def initialize(hash, logger)
        @hash = hash
        @logger = logger
      end

      def [](k)
        @hash[k]
      end

      def to_s
        "me"
      end

    end

    let (:opts)     { @opts || {} }
    let (:logger)   { double( 'logger' ).as_null_object }
    let (:instance) { WindowsExecTest.new(opts, logger) }

    describe '#prepend_commands' do
      it 'sets spacing correctly if both parts are defined' do
        allow( instance ).to receive( :is_cygwin? ).and_return( true )
        command_str = instance.prepend_commands( 'command', 'pants', { :cmd_exe => true } )
        expect( command_str ).to be === 'cmd.exe /c pants'
      end

      it 'sets spacing empty if one is not supplied' do
        allow( instance ).to receive( :is_cygwin? ).and_return( true )
        command_str = instance.prepend_commands( 'command', 'pants' )
        expect( command_str ).to be === 'pants'
      end

      it 'does not use cmd.exe by default' do
        allow( instance ).to receive( :is_cygwin? ).and_return( true )
        command_str = instance.prepend_commands( 'pants' )
        expect( command_str ).not_to match( /cmd\.exe/ )
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
beaker-2.49.0 spec/beaker/host/windows/exec_spec.rb
beaker-2.48.1 spec/beaker/host/windows/exec_spec.rb
beaker-2.48.0 spec/beaker/host/windows/exec_spec.rb
beaker-2.47.1 spec/beaker/host/windows/exec_spec.rb
beaker-2.47.0 spec/beaker/host/windows/exec_spec.rb
beaker-2.46.0 spec/beaker/host/windows/exec_spec.rb
beaker-2.45.0 spec/beaker/host/windows/exec_spec.rb
beaker-2.44.0 spec/beaker/host/windows/exec_spec.rb
beaker-2.43.0 spec/beaker/host/windows/exec_spec.rb
beaker-2.42.0 spec/beaker/host/windows/exec_spec.rb
beaker-2.41.0 spec/beaker/host/windows/exec_spec.rb
beaker-2.40.0 spec/beaker/host/windows/exec_spec.rb
beaker-2.39.0 spec/beaker/host/windows/exec_spec.rb
beaker-2.38.1 spec/beaker/host/windows/exec_spec.rb
beaker-2.38.0 spec/beaker/host/windows/exec_spec.rb
beaker-2.37.0 spec/beaker/host/windows/exec_spec.rb
beaker-2.36.0 spec/beaker/host/windows/exec_spec.rb
beaker-2.35.0 spec/beaker/host/windows/exec_spec.rb
beaker-2.34.0 spec/beaker/host/windows/exec_spec.rb