grit 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/test/test_tree.rb ADDED
@@ -0,0 +1,61 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ class TestTree < Test::Unit::TestCase
4
+ def setup
5
+ @r = Repo.new(GRIT_REPO)
6
+ @t = Tree.allocate
7
+ end
8
+
9
+ # contents
10
+
11
+ def test_contents_should_cache
12
+ Git.any_instance.expects(:ls_tree).returns(
13
+ fixture('ls_tree_a'),
14
+ fixture('ls_tree_b')
15
+ ).times(2)
16
+ tree = @r.tree('master')
17
+
18
+ child = tree.contents.last
19
+
20
+ child.contents
21
+ child.contents
22
+ end
23
+
24
+ # content_from_string
25
+
26
+ def test_content_from_string_tree_should_return_tree
27
+ text = fixture('ls_tree_a').split("\n").last
28
+
29
+ tree = @t.content_from_string(nil, text)
30
+
31
+ assert_equal Tree, tree.class
32
+ assert_equal "650fa3f0c17f1edb4ae53d8dcca4ac59d86e6c44", tree.id
33
+ assert_equal "040000", tree.mode
34
+ assert_equal "test", tree.name
35
+ end
36
+
37
+ def test_content_from_string_invalid_type_should_raise
38
+ assert_raise(RuntimeError) do
39
+ @t.content_from_string(nil, "040000 bogus 650fa3f0c17f1edb4ae53d8dcca4ac59d86e6c44 test")
40
+ end
41
+ end
42
+
43
+ # /
44
+
45
+ def test_slash
46
+ Git.any_instance.expects(:ls_tree).returns(
47
+ fixture('ls_tree_a')
48
+ )
49
+ tree = @r.tree('master')
50
+
51
+ assert_equal 'aa06ba24b4e3f463b3c4a85469d0fb9e5b421cf8', (tree/'lib').id
52
+ assert_equal '8b1e02c0fb554eed2ce2ef737a68bb369d7527df', (tree/'README.txt').id
53
+ end
54
+
55
+ # inspect
56
+
57
+ def test_inspect
58
+ @t = Tree.create(@r, :id => 'abc')
59
+ assert_equal %Q{#<Grit::Tree "abc">}, @t.inspect
60
+ end
61
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.4
3
+ specification_version: 1
4
+ name: grit
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.7.0
7
+ date: 2008-01-07 00:00:00 -08:00
8
+ summary: Object model interface to a git repo
9
+ require_paths:
10
+ - lib
11
+ email: tom@rubyisawesome.com
12
+ homepage: http://grit.rubyforge.org
13
+ rubyforge_project: grit
14
+ description: Grit is a Ruby library for extracting information from a git repository in and object oriented manner.
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Tom Preston-Werner
31
+ files:
32
+ - History.txt
33
+ - Manifest.txt
34
+ - README.txt
35
+ - Rakefile
36
+ - lib/grit.rb
37
+ - lib/grit/actor.rb
38
+ - lib/grit/blob.rb
39
+ - lib/grit/commit.rb
40
+ - lib/grit/diff.rb
41
+ - lib/grit/errors.rb
42
+ - lib/grit/git.rb
43
+ - lib/grit/head.rb
44
+ - lib/grit/lazy.rb
45
+ - lib/grit/repo.rb
46
+ - lib/grit/tree.rb
47
+ - test/fixtures/blame
48
+ - test/fixtures/cat_file_blob
49
+ - test/fixtures/cat_file_blob_size
50
+ - test/fixtures/diff_p
51
+ - test/fixtures/for_each_ref
52
+ - test/fixtures/ls_tree_a
53
+ - test/fixtures/ls_tree_b
54
+ - test/fixtures/rev_list
55
+ - test/fixtures/rev_list_single
56
+ - test/fixtures/rev_parse
57
+ - test/helper.rb
58
+ - test/profile.rb
59
+ - test/suite.rb
60
+ - test/test_actor.rb
61
+ - test/test_blob.rb
62
+ - test/test_commit.rb
63
+ - test/test_git.rb
64
+ - test/test_head.rb
65
+ - test/test_reality.rb
66
+ - test/test_repo.rb
67
+ - test/test_tree.rb
68
+ test_files:
69
+ - test/test_actor.rb
70
+ - test/test_blob.rb
71
+ - test/test_commit.rb
72
+ - test/test_git.rb
73
+ - test/test_head.rb
74
+ - test/test_reality.rb
75
+ - test/test_repo.rb
76
+ - test/test_tree.rb
77
+ rdoc_options:
78
+ - --main
79
+ - README.txt
80
+ extra_rdoc_files:
81
+ - History.txt
82
+ - Manifest.txt
83
+ - README.txt
84
+ executables: []
85
+
86
+ extensions: []
87
+
88
+ requirements: []
89
+
90
+ dependencies:
91
+ - !ruby/object:Gem::Dependency
92
+ name: hoe
93
+ version_requirement:
94
+ version_requirements: !ruby/object:Gem::Version::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 1.4.0
99
+ version: