Sha256: 50d44004d4d3802eaa268a6a4b4965ce30ffd2c741434871a4b6d5e21c755500

Contents?: true

Size: 1.7 KB

Versions: 47

Compression:

Stored size: 1.7 KB

Contents

require 'spec_helper'

module Beaker
  describe Windows::File do
    let (:user) { 'someuser' }
    let (:group) { 'somegroup' }
    let (:path) { 'C:\Foo\Bar' }
    let (:newpath) { '/Foo/Bar' }
    let(:host)    { make_host( 'name', { :platform => 'windows' } ) }


    describe '#chown' do
      it 'calls cygpath first' do
        expect( host ).to receive( :execute ).with( "cygpath -u #{path}" )
        expect( host ).to receive( :execute ).with( /chown/ )

        host.chown( user, path )
      end

      it 'passes cleaned path to super' do
        allow_any_instance_of( Windows::Host ).to receive( :execute ).with( /cygpath/ ).and_return( newpath )
        expect_any_instance_of( Unix::Host ).to receive( :chown ).with( user, newpath , true)

        host.chown( user, path, true )
      end
    end

    describe '#chgrp' do
      it 'calls cygpath first' do
        expect( host ).to receive( :execute ).with( "cygpath -u #{path}" ).and_return( path )
        expect( host ).to receive( :execute ).with( "chgrp #{group} #{path}" )

        host.chgrp( group, path )
      end

      it 'passes cleaned path to super' do
        allow_any_instance_of( Windows::Host ).to receive( :execute ).with( /cygpath/ ).and_return( newpath )
        expect_any_instance_of( Unix::Host ).to receive( :chgrp ).with( group, newpath , true)

        host.chgrp( group, path, true )
      end
    end

    describe '#ls_ld' do
      let(:result) { Beaker::Result.new(host, 'ls') }

      it 'calls cygpath first' do
        expect( host ).to receive( :execute ).with( "cygpath -u #{path}" ).and_return( path )
        expect( host ).to receive( :execute ).with( "ls -ld #{path}" )

        host.ls_ld( path )
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
beaker-4.6.0 spec/beaker/host/windows/file_spec.rb
beaker-4.5.0 spec/beaker/host/windows/file_spec.rb
beaker-4.4.0 spec/beaker/host/windows/file_spec.rb
beaker-4.3.0 spec/beaker/host/windows/file_spec.rb
beaker-4.2.0 spec/beaker/host/windows/file_spec.rb
beaker-4.1.0 spec/beaker/host/windows/file_spec.rb
beaker-4.0.0 spec/beaker/host/windows/file_spec.rb