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.22.1 spec/beaker/host/windows/file_spec.rb
beaker-4.22.0 spec/beaker/host/windows/file_spec.rb
beaker-4.21.0 spec/beaker/host/windows/file_spec.rb
beaker-4.20.0 spec/beaker/host/windows/file_spec.rb
beaker-4.19.0 spec/beaker/host/windows/file_spec.rb
beaker-4.18.0 spec/beaker/host/windows/file_spec.rb
beaker-4.17.0 spec/beaker/host/windows/file_spec.rb
beaker-4.16.0 spec/beaker/host/windows/file_spec.rb
beaker-4.15.0 spec/beaker/host/windows/file_spec.rb
beaker-4.14.1 spec/beaker/host/windows/file_spec.rb
beaker-4.14.0 spec/beaker/host/windows/file_spec.rb
beaker-4.13.1 spec/beaker/host/windows/file_spec.rb
beaker-4.13.0 spec/beaker/host/windows/file_spec.rb
beaker-4.12.0 spec/beaker/host/windows/file_spec.rb
beaker-4.11.1 spec/beaker/host/windows/file_spec.rb
beaker-4.11.0 spec/beaker/host/windows/file_spec.rb
beaker-4.10.0 spec/beaker/host/windows/file_spec.rb
beaker-4.9.0 spec/beaker/host/windows/file_spec.rb
beaker-4.8.0 spec/beaker/host/windows/file_spec.rb
beaker-4.7.0 spec/beaker/host/windows/file_spec.rb