schacon-grit 0.9.4 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/test_tag.rb DELETED
@@ -1,25 +0,0 @@
1
- require File.dirname(__FILE__) + '/helper'
2
-
3
- class TestTag < Test::Unit::TestCase
4
- def setup
5
- @r = Repo.new(File.join(File.dirname(__FILE__), *%w[dot_git]), :is_bare => true)
6
- end
7
-
8
- # list_from_string
9
-
10
- def test_list_from_string
11
- tags = @r.tags
12
-
13
- assert_equal 2, tags.size
14
- assert_equal 'v0.7.0', tags.first.name
15
- assert_equal 'f0055fda16c18fd8b27986dbf038c735b82198d7', tags.first.commit.id
16
- end
17
-
18
- # inspect
19
-
20
- def test_inspect
21
- tag = @r.tags.first
22
-
23
- assert_equal %Q{#<Grit::Tag "#{tag.name}">}, tag.inspect
24
- end
25
- end
data/test/test_tree.rb DELETED
@@ -1,96 +0,0 @@
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
- def test_nosuch_tree
11
- t = @r.tree('blahblah')
12
- assert t.contents.is_a?(Array)
13
- assert t.is_a?(Tree)
14
- end
15
-
16
- def test_contents_should_cache
17
- Git.any_instance.expects(:ls_tree).returns(
18
- fixture('ls_tree_a'),
19
- fixture('ls_tree_b')
20
- ).times(2)
21
- tree = @r.tree('master')
22
-
23
- child = tree.contents.last
24
-
25
- child.contents
26
- child.contents
27
- end
28
-
29
- # content_from_string
30
-
31
- def test_content_from_string_tree_should_return_tree
32
- text = fixture('ls_tree_a').split("\n").last
33
-
34
- tree = @t.content_from_string(nil, text)
35
-
36
- assert_equal Tree, tree.class
37
- assert_equal "650fa3f0c17f1edb4ae53d8dcca4ac59d86e6c44", tree.id
38
- assert_equal "040000", tree.mode
39
- assert_equal "test", tree.name
40
- end
41
-
42
- def test_content_from_string_tree_should_return_blob
43
- text = fixture('ls_tree_b').split("\n").first
44
-
45
- tree = @t.content_from_string(nil, text)
46
-
47
- assert_equal Blob, tree.class
48
- assert_equal "aa94e396335d2957ca92606f909e53e7beaf3fbb", tree.id
49
- assert_equal "100644", tree.mode
50
- assert_equal "grit.rb", tree.name
51
- end
52
-
53
- def test_content_from_string_tree_should_return_submodule
54
- text = fixture('ls_tree_submodule').split("\n").first
55
-
56
- sm = @t.content_from_string(nil, text)
57
-
58
- assert_kind_of Submodule, sm
59
- end
60
-
61
- def test_content_from_string_invalid_type_should_raise
62
- assert_raise(RuntimeError) do
63
- @t.content_from_string(nil, "040000 bogus 650fa3f0c17f1edb4ae53d8dcca4ac59d86e6c44 test")
64
- end
65
- end
66
-
67
- # /
68
-
69
- def test_slash
70
- Git.any_instance.expects(:ls_tree).returns(
71
- fixture('ls_tree_a')
72
- )
73
- tree = @r.tree('master')
74
-
75
- assert_equal 'aa06ba24b4e3f463b3c4a85469d0fb9e5b421cf8', (tree/'lib').id
76
- assert_equal '8b1e02c0fb554eed2ce2ef737a68bb369d7527df', (tree/'README.txt').id
77
- end
78
-
79
- def test_slash_with_commits
80
- Git.any_instance.expects(:ls_tree).returns(
81
- fixture('ls_tree_commit')
82
- )
83
- tree = @r.tree('master')
84
-
85
- assert_equal 'd35b34c6e931b9da8f6941007a92c9c9a9b0141a', (tree/'bar').id
86
- assert_equal '2afb47bcedf21663580d5e6d2f406f08f3f65f19', (tree/'foo').id
87
- assert_equal 'f623ee576a09ca491c4a27e48c0dfe04be5f4a2e', (tree/'baz').id
88
- end
89
-
90
- # inspect
91
-
92
- def test_inspect
93
- @t = Tree.create(@r, :id => 'abc')
94
- assert_equal %Q{#<Grit::Tree "abc">}, @t.inspect
95
- end
96
- end