Added simple implementation to check if git is installed before

executing commands.
This commit is contained in:
Jeremy Cook
2014-11-08 13:28:22 -05:00
parent 63c45d7c3a
commit b7e2b45e69
2 changed files with 18 additions and 2 deletions

View File

@@ -13,7 +13,7 @@ describe Homesick::CLI do
before { allow(homesick).to receive(:repos_dir).and_return(castles) }
describe 'smoke test' do
describe 'smoke tests' do
context 'when running bin/homesick' do
before do
bin_path = Pathname.new(__FILE__).parent.parent
@@ -23,6 +23,17 @@ describe Homesick::CLI do
expect(@output.length).to be > 0
end
end
context 'when git is not installed' do
before do
# The following line suppresses Thor warnings about overriding methods.
allow($stdout).to receive(:write).at_least(:once)
expect_any_instance_of(Homesick::CLI).to receive(:`).and_return('')
end
it 'should raise an exception when Git is not installed' do
Capture.stdout{ expect{Homesick::CLI.new}.to raise_error SystemExit }
end
end
end
describe 'clone' do