summaryrefslogtreecommitdiffstats
path: root/tests/units/test_tags.rb
blob: 7d6f279436a86da26cb3c3363b763584bc2a5b62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../test_helper'

class TestTags < Test::Unit::TestCase
  def setup
    set_file_paths
  end
  
  def test_tags
    in_temp_dir do |path|
      r1 = Git.clone(@wbare, 'repo1')
      r2 = Git.clone(@wbare, 'repo2')
        
      assert_raise Git::GitTagNameDoesNotExist do
        r1.tag('first')
      end
      
      r1.add_tag('first')
      r1.chdir do 
        new_file('new_file', 'new content')
      end
      r1.add
      r1.commit('my commit')
      r1.add_tag('second')
      
      assert(r1.tags.map{|t| t.name}.include?('first'))
      
      r2.add_tag('third')
      
      assert(r2.tags.map{|t| t.name}.include?('third'))
      assert(!r2.tags.map{|t| t.name}.include?('second'))
    end
  end
end