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.36.1 spec/beaker/host/windows/file_spec.rb
beaker-4.36.0 spec/beaker/host/windows/file_spec.rb
beaker-4.35.0 spec/beaker/host/windows/file_spec.rb
beaker-4.34.0 spec/beaker/host/windows/file_spec.rb
beaker-4.33.0 spec/beaker/host/windows/file_spec.rb
beaker-4.32.0 spec/beaker/host/windows/file_spec.rb
beaker-4.31.0 spec/beaker/host/windows/file_spec.rb
beaker-4.30.0 spec/beaker/host/windows/file_spec.rb
beaker-4.29.1 spec/beaker/host/windows/file_spec.rb
beaker-4.29.0 spec/beaker/host/windows/file_spec.rb
beaker-4.28.1 spec/beaker/host/windows/file_spec.rb
beaker-4.28.0 spec/beaker/host/windows/file_spec.rb
beaker-4.27.1 spec/beaker/host/windows/file_spec.rb
beaker-4.27.0 spec/beaker/host/windows/file_spec.rb
beaker-4.26.0 spec/beaker/host/windows/file_spec.rb
beaker-4.25.0 spec/beaker/host/windows/file_spec.rb
beaker-4.24.0 spec/beaker/host/windows/file_spec.rb
beaker-4.23.2 spec/beaker/host/windows/file_spec.rb
beaker-4.23.1 spec/beaker/host/windows/file_spec.rb
beaker-4.23.0 spec/beaker/host/windows/file_spec.rb