Permalink
Browse files

Fix a bunch of test failures due to new git fetch code.

  • Loading branch information...
1 parent 72224b2 commit b5b1cae94853f3b6e9d2c11d8c970e7cbfaeb024 @relistan relistan committed Jan 14, 2014
Showing with 9 additions and 3 deletions.
  1. +9 −3 spec/capistrano_deploy_tags_spec.rb
View
12 spec/capistrano_deploy_tags_spec.rb
@@ -24,19 +24,22 @@ def with_clean_repo(&block)
end
context "prepare_tree" do
- before :each do
+ before do
configuration.set(:branch, 'master')
configuration.set(:stage, 'test')
end
it "raises an error when not in a git tree" do
FileUtils.chdir '/tmp'
+ configuration.cdt.stub(exec_success?: true)
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/)
+ with_clean_repo do
+ configuration.cdt.should_receive(:exec_success?).and_return(false)
+ expect { configuration.find_and_execute_task('git:prepare_tree') }.to raise_error(/'git fetch ' failed/)
+ end
end
context "with a clean git tree" do
@@ -55,6 +58,7 @@ def with_clean_repo(&block)
it "does not raise an error when run from a clean tree" do
with_clean_repo do
+ configuration.cdt.stub(exec_success?: true)
expect { configuration.find_and_execute_task('git:prepare_tree') }.to_not raise_error
end
end
@@ -71,6 +75,7 @@ def with_clean_repo(&block)
with_clean_repo do
system('git remote add nowhere git@example.com:nowhere')
configuration.set(:git_remote, 'nowhere')
+ configuration.cdt.stub(pending_git_changes?: false)
configuration.cdt.should_receive(:safe_run).with('git', 'checkout', 'master')
configuration.cdt.should_receive(:safe_run).with('git', 'pull', 'nowhere', 'master')
configuration.find_and_execute_task('git:prepare_tree')
@@ -79,6 +84,7 @@ def with_clean_repo(&block)
it "uses the first remote when one is not specified" do
with_clean_repo do
+ configuration.cdt.stub(pending_git_changes?: false)
system('git remote add somewhere git@example.com:somewhere')
configuration.cdt.should_receive(:safe_run).with('git', 'checkout', 'master')
configuration.cdt.should_receive(:safe_run).with('git', 'pull', 'somewhere', 'master')

0 comments on commit b5b1cae

Please sign in to comment.