]> source.dussan.org Git - redmine.git/commitdiff
scm: mercurial: test: model: add test of parents (#5501)
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 3 Nov 2011 08:03:38 +0000 (08:03 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 3 Nov 2011 08:03:38 +0000 (08:03 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7714 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/repository_mercurial_test.rb

index f33640d117767d1fb2ace202f9d199aa6b4b1435..7dc58f8fc88ed01c0b76c736d067e4e8309e335c 100644 (file)
@@ -260,6 +260,25 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
       end
     end
 
+    def test_parents
+      assert_equal 0, @repository.changesets.count
+      @repository.fetch_changesets
+      @project.reload
+      assert_equal NUM_REV, @repository.changesets.count
+      r1 = @repository.changesets.find_by_revision('0')
+      assert_equal [], r1.parents
+      r2 = @repository.changesets.find_by_revision('1')
+      assert_equal 1, r2.parents.length
+      assert_equal "0885933ad4f6",
+                   r2.parents[0].identifier
+      r3 = @repository.changesets.find_by_revision('30')
+      assert_equal 2, r3.parents.length
+      assert_equal "a94b0528f24f",
+                   r3.parents[0].identifier
+      assert_equal "3a330eb32958",
+                   r3.parents[1].identifier
+    end
+
     def test_activities
       c = Changeset.new(:repository   => @repository,
                         :committed_on => Time.now,