1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

Fix git SCM module unit tests (closes #11221)

git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@8938 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jamis Buck 2008-02-28 03:38:15 +00:00
parent 23a6f61e68
commit 645fff0ac5

View file

@ -15,14 +15,16 @@ class DeploySCMGitTest < Test::Unit::TestCase
def test_head def test_head
assert_equal "HEAD", @source.head assert_equal "HEAD", @source.head
# With :branch
@config[:branch] = "master" @config[:branch] = "master"
assert_equal "master", @source.head assert_equal "master", @source.head
end end
def origin def test_origin
asser_equal "origin", @source.origin assert_equal "origin", @source.origin
@config[:remote] = "git" @config[:remote] = "username"
assert_equal "git", @source.origin assert_equal "username", @source.origin
end end
def test_checkout def test_checkout
@ -31,9 +33,10 @@ class DeploySCMGitTest < Test::Unit::TestCase
rev = 'c2d9e79' 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) 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 # With :scm_command
@config[:branch] = "origin/foo" git = "/opt/local/bin/git"
assert_equal "git clone git@somehost.com:project.git /var/www && cd /var/www && git checkout -b deploy #{rev}", @source.checkout(rev, dest) @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 end
def test_diff def test_diff
@ -61,11 +64,6 @@ class DeploySCMGitTest < Test::Unit::TestCase
rev = 'c2d9e79' rev = 'c2d9e79'
assert_equal "cd #{dest} && git fetch origin && git reset --hard #{rev}", @source.sync(rev, dest) 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 # With :scm_command
git = "/opt/local/bin/git" git = "/opt/local/bin/git"
@config[:scm_command] = git @config[:scm_command] = git
@ -90,11 +88,6 @@ class DeploySCMGitTest < Test::Unit::TestCase
dest = "/var/www" dest = "/var/www"
rev = 'c2d9e79' 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) 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 end
def test_remote_clone def test_remote_clone
@ -103,10 +96,6 @@ class DeploySCMGitTest < Test::Unit::TestCase
dest = "/var/www" dest = "/var/www"
rev = 'c2d9e79' 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) 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 end
# Tests from base_test.rb, makin' sure we didn't break anything up there! # Tests from base_test.rb, makin' sure we didn't break anything up there!