Don't try to clone uri's without a corresponding destination

The code throws the exception

  undefined method `join' for nil:NilClass

if destionation doesn't exist - so it's better to not call git_clone if
destination is not present.
This commit is contained in:
Jacob Atzen
2010-08-17 10:04:59 +02:00
parent 546f078f99
commit 0440cd672d
2 changed files with 22 additions and 5 deletions

View File

@@ -34,6 +34,24 @@ describe Homesick do
@homesick.clone 'http://github.com/technicalpickles/pickled-vim.git'
end
it "should clone git repo like http://host/path/to" do
@homesick.should_receive(:git_clone).with('http://github.com/technicalpickles/pickled-vim')
@homesick.clone 'http://github.com/technicalpickles/pickled-vim'
end
it "should not try to clone a malformed uri like malformed" do
@homesick.should_not_receive(:git_clone)
@homesick.clone 'malformed' rescue nil
end
it "should throw an exception when trying to clone a malformed uri like malformed" do
lambda {
@homesick.clone 'malformed'
}.should raise_error
end
it "should clone a github repo" do
@homesick.should_receive(:git_clone).with('git://github.com/wfarr/dotfiles.git', :destination => Pathname.new('wfarr/dotfiles'))