scm: git: add tests for previous and next versions in unit model test (#7821, #5357).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5074 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-03-10 04:31:10 +00:00
parent 6dc57e752d
commit c072d3b62f
1 changed files with 40 additions and 0 deletions

View File

@ -268,6 +268,46 @@ class RepositoryGitTest < ActiveSupport::TestCase
c = @repository.changesets.find_by_revision('ed5bb786bbda2dee66a2d50faf51429dbc043a7b') c = @repository.changesets.find_by_revision('ed5bb786bbda2dee66a2d50faf51429dbc043a7b')
assert_equal "#{str_felix_hex} <felix@fachschaften.org>", c.committer assert_equal "#{str_felix_hex} <felix@fachschaften.org>", c.committer
end end
def test_previous
@repository.fetch_changesets
@repository.reload
%w|1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127 1ca7f5ed|.each do |r1|
changeset = @repository.find_changeset_by_name(r1)
%w|64f1f3e89ad1cb57976ff0ad99a107012ba3481d 64f1f3e89ad1|.each do |r2|
assert_equal @repository.find_changeset_by_name(r2), changeset.previous
end
end
end
def test_previous_nil
@repository.fetch_changesets
@repository.reload
%w|7234cb2750b63f47bff735edc50a1c0a433c2518 7234cb2|.each do |r1|
changeset = @repository.find_changeset_by_name(r1)
assert_nil changeset.previous
end
end
def test_next
@repository.fetch_changesets
@repository.reload
%w|64f1f3e89ad1cb57976ff0ad99a107012ba3481d 64f1f3e89ad1|.each do |r2|
changeset = @repository.find_changeset_by_name(r2)
%w|1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127 1ca7f5ed|.each do |r1|
assert_equal @repository.find_changeset_by_name(r1), changeset.next
end
end
end
def test_next_nil
@repository.fetch_changesets
@repository.reload
%w|1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127 1ca7f5ed|.each do |r1|
changeset = @repository.find_changeset_by_name(r1)
assert_nil changeset.next
end
end
else else
puts "Git test repository NOT FOUND. Skipping unit tests !!!" puts "Git test repository NOT FOUND. Skipping unit tests !!!"
def test_fake; assert true end def test_fake; assert true end