From 645fff0ac5fe1ae925c13c759116e9d79063b369 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Thu, 28 Feb 2008 03:38:15 +0000 Subject: [PATCH] Fix git SCM module unit tests (closes #11221) git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@8938 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- test/deploy/scm/git_test.rb | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/test/deploy/scm/git_test.rb b/test/deploy/scm/git_test.rb index be214f901..5d7e8795e 100644 --- a/test/deploy/scm/git_test.rb +++ b/test/deploy/scm/git_test.rb @@ -15,14 +15,16 @@ def @config.exists?(name); key?(name); end def test_head assert_equal "HEAD", @source.head + + # With :branch @config[:branch] = "master" assert_equal "master", @source.head end - def origin - asser_equal "origin", @source.origin - @config[:remote] = "git" - assert_equal "git", @source.origin + def test_origin + assert_equal "origin", @source.origin + @config[:remote] = "username" + assert_equal "username", @source.origin end def test_checkout @@ -31,9 +33,10 @@ def test_checkout rev = 'c2d9e79' assert_equal "git clone git@somehost.com:project.git /var/www && cd /var/www && git checkout -b deploy #{rev}", @source.checkout(rev, dest) - # With branch - @config[:branch] = "origin/foo" - assert_equal "git clone git@somehost.com:project.git /var/www && cd /var/www && git checkout -b deploy #{rev}", @source.checkout(rev, dest) + # With :scm_command + git = "/opt/local/bin/git" + @config[:scm_command] = git + assert_equal "#{git} clone git@somehost.com:project.git /var/www && cd /var/www && #{git} checkout -b deploy #{rev}", @source.checkout(rev, dest) end def test_diff @@ -61,11 +64,6 @@ def test_sync rev = 'c2d9e79' assert_equal "cd #{dest} && git fetch origin && git reset --hard #{rev}", @source.sync(rev, dest) - # With branch - @config[:branch] = "foo" - rev = '92d9e79' # simulate rev change - assert_equal "cd #{dest} && git fetch origin && git reset --hard #{rev}", @source.sync(rev, dest) - # With :scm_command git = "/opt/local/bin/git" @config[:scm_command] = git @@ -90,11 +88,6 @@ def test_shallow_clone dest = "/var/www" rev = 'c2d9e79' assert_equal "git clone --depth 1 git@somehost.com:project.git /var/www && cd /var/www && git checkout -b deploy #{rev}", @source.checkout(rev, dest) - - # With branch - @config[:branch] = "origin/foo" - rev = '92d9e79' # simulate rev change - assert_equal "git clone --depth 1 git@somehost.com:project.git /var/www && cd /var/www && git checkout -b deploy #{rev}", @source.checkout(rev, dest) end def test_remote_clone @@ -103,10 +96,6 @@ def test_remote_clone dest = "/var/www" rev = 'c2d9e79' assert_equal "git clone -o username git@somehost.com:project.git /var/www && cd /var/www && git checkout -b deploy #{rev}", @source.checkout(rev, dest) - - # With branch - @config[:branch] = "foo" - assert_equal "git clone -o username git@somehost.com:project.git /var/www && cd /var/www && git checkout -b deploy #{rev}", @source.checkout(rev, dest) end # Tests from base_test.rb, makin' sure we didn't break anything up there!