Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix git SCM module unit tests (closes #11221)

git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@8938 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit c6c6afc4b3cadd7ecd2533b8518be7b1b7c5b82b 1 parent 9ac88c7
@jamis jamis authored
Showing with 10 additions and 21 deletions.
  1. +10 −21 test/deploy/scm/git_test.rb
View
31 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!
Please sign in to comment.
Something went wrong with that request. Please try again.