summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorscott Chacon <schacon@agadorsparticus.corp.reactrix.com>2007-11-14 10:24:22 -0800
committerscott Chacon <schacon@agadorsparticus.corp.reactrix.com>2007-11-14 10:24:22 -0800
commitdf27b5e7d6cb210b5a0870eb671a983336fb95c7 (patch)
treeb2e1c449e04de4adb7048ee84e02c1cab50557e4 /tests
parentcbf72e3bfd1f62b35cc2db623be531f7f9c9275c (diff)
downloadthird_party-ruby-git-df27b5e7d6cb210b5a0870eb671a983336fb95c7.zip
third_party-ruby-git-df27b5e7d6cb210b5a0870eb671a983336fb95c7.tar.gz
third_party-ruby-git-df27b5e7d6cb210b5a0870eb671a983336fb95c7.tar.xz
added 'archive' and tests
Diffstat (limited to 'tests')
-rw-r--r--tests/units/test_archive.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/units/test_archive.rb b/tests/units/test_archive.rb
new file mode 100644
index 0000000..2e405b3
--- /dev/null
+++ b/tests/units/test_archive.rb
@@ -0,0 +1,44 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../test_helper'
+
+class TestArchive < Test::Unit::TestCase
+
+ def setup
+ set_file_paths
+ @git = Git.open(@wdir)
+ end
+
+ def tempfile
+ Tempfile.new('archive-test').path
+ end
+
+ def test_archive
+ f = @git.archive('v2.6', tempfile)
+ assert(File.exists?(f))
+
+ f = @git.object('v2.6').archive(tempfile) # writes to given file
+ assert(File.exists?(f))
+
+ f = @git.object('v2.6').archive # returns path to temp file
+ assert(File.exists?(f))
+
+ f = @git.object('v2.6').archive(tempfile, :format => 'zip')
+ assert(File.file?(f))
+
+ f = @git.object('v2.6').archive(tempfile, :format => 'tgz', :prefix => 'test/')
+ assert(File.exists?(f))
+
+ f = @git.object('v2.6').archive(tempfile, :format => 'tar', :prefix => 'test/', :path => 'ex')
+ assert(File.exists?(f))
+
+ in_temp_dir do
+ c = Git.clone(@wbare, 'new')
+ c.chdir do
+ f = @git.remote('origin').branch('master').archive(tempfile, :format => 'tgz')
+ assert(File.exists?(f))
+ end
+ end
+ end
+
+end \ No newline at end of file