added branches, more log stuff, better tests, changed the log api a bit
[rubygit.git] / tests / units / test_branch.rb
blobea242fc24400e280a77990b6e07316789c024560
1 #!/usr/bin/env ruby
3 require File.dirname(__FILE__) + '/../test_helper'
5 class TestBranch < Test::Unit::TestCase
6   def setup
7     set_file_paths
8     @git = Git.open(@wdir)
9     
10     @commit = @git.object('1cc8667014381')
11     @tree = @git.object('1cc8667014381^{tree}')
12     @blob = @git.object('v2.5:example.txt')
13     
14     @branches = @git.branches
15   end
17   
18   def test_branches_all
19     assert(@git.branches[:master].is_a?(Git::Branch))
20     assert(@git.branches.size > 5)
21   end
22   
23   def test_branches_local
24     bs = @git.branches.local
25     assert(bs.size > 4)
26   end
28   def test_branches_remote
29     bs = @git.branches.remote
30     assert_equal(1, bs.size)
31   end
32   
33   def test_branches_single
34     b = @git.branches[:test_object]
35     assert_equal('test_object', b.name)
37     b = @git.branches['working/master']
38     assert_equal('master', b.name)
39     assert_equal('working/master', b.full)
40     assert_equal('working', b.remote.name)
41     assert_equal('+refs/heads/*:refs/remotes/working/*', b.remote.fetch)
42     assert_equal('../working.git', b.remote.url)
43   end
44   
45   def test_branch_commit
46     assert_equal(270, @git.branches[:test_branches].commit.size)
47   end
48   
49 end