Sha256: af69162de6dbd2bb5baa4aba8710bb33e1fb7f894a209623a4fc9e8e74332bd2
Contents?: true
Size: 1.33 KB
Versions: 120
Compression:
Stored size: 1.33 KB
Contents
# encoding: utf-8 require 'spec_helper' require 'fedux_org_stdlib/command/which' RSpec.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
120 entries across 120 versions & 1 rubygems