Sha256: 80e79385675aa44d4925f649ca3c03b9689b90677e2958bdf93d67b3b42db4b4
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
# -*- encoding: utf-8 -*- require 'spec_helper' describe TTY::System::Which, '#which' do let(:path) { "/usr/local/bin:/usr/local/git/bin" } let(:extension) { '.bat' } subject { described_class.new(command) } context 'without extension' do let(:command) { 'ruby' } before { ENV.stub(:[]).with('PATHEXT').and_return(nil) ENV.stub(:[]).with('PATH').and_return(path) } it 'finds command' do File.stub(:executable?) { true } expect(subject.which).to eql "/usr/local/bin/ruby" end it "doesn't find command" do File.stub(:executable?) { false } expect(subject.which).to be_nil end end context 'with extension' do let(:command) { 'ruby' } before { ENV.stub(:[]).with('PATHEXT').and_return(extension) ENV.stub(:[]).with('PATH').and_return(path) } it 'finds command' do File.stub(:executable?) { true } expect(subject.which).to eql "/usr/local/bin/ruby.bat" end it "doesn't find command" do File.stub(:executable?) { false } expect(subject.which).to be_nil end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tty-0.0.11 | spec/tty/system/which/which_spec.rb |
tty-0.0.10 | spec/tty/system/which/which_spec.rb |