Add test for validating git fetch.

This commit is contained in:
Karl Matthias
2014-01-13 20:57:13 -08:00
parent d5a6d036c9
commit 72224b2d96
2 changed files with 17 additions and 7 deletions
+10 -2
View File
@@ -24,13 +24,21 @@ describe Capistrano::DeployTags do
end
context "prepare_tree" do
it "raises an error when not in a git tree" do
FileUtils.chdir '/tmp'
before :each do
configuration.set(:branch, 'master')
configuration.set(:stage, 'test')
end
it "raises an error when not in a git tree" do
FileUtils.chdir '/tmp'
expect { configuration.find_and_execute_task('git:prepare_tree') }.to raise_error('git checkout master failed!')
end
it "raises when unable to fetch" do
configuration.cdt.should_receive(:exec_success?).and_return(false)
expect { configuration.find_and_execute_task('git:prepare_tree') }.to raise_error(/'git fetch origin' failed/)
end
context "with a clean git tree" do
before :each do
configuration.set(:branch, 'master')