Sha256: 5fb1b320cf3d47145f813d2f9a45cc0c0bf707657e426bc82c45cb879745996a
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 KB
Contents
require 'spec_helper' require 'fedux_org/stdlib/command/which' describe Command::Which do context '#which' do klass = Class.new do include Command::Which end it 'returns full path for a valid command' do expect(klass.new.which( 'which' )).to eq( '/usr/bin/which' ) end it 'returns full path for a valid command although a full path is given' do expect(klass.new.which( '/usr/bin/which' )).to eq( '/usr/bin/which' ) end it 'returns nil for a invalid command if a full path is given' do expect(klass.new.which( '/usr/bin/which1' )).to eq( nil ) end it 'returns nil if no executable can be found in path' do expect(klass.new.which('asdfasdf')).to eq( nil ) end it 'uses paths string to search for command' do expect(klass.new.which('which', paths: '/usr/bin')).to eq('/usr/bin/which') end it 'uses paths array to search for command' do expect(klass.new.which('which', paths: ['/usr/bin'])).to eq('/usr/bin/which') end it 'uses pathexts to search for command' do expect(klass.new.which('which', paths: ['/usr/bin'], pathexts: '')).to eq('/usr/bin/which') end it 'uses pathexts array to search for command' do expect(klass.new.which( 'which', paths: ['/usr/bin'], pathexts: [''])).to eq('/usr/bin/which') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fedux_org-stdlib-0.3.2 | spec/command/which_spec.rb |