scm: mercurial: add changesets order test in unit model test (#5357).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5002 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-03-04 14:03:19 +00:00 committed by Eric Davis
parent ac58816e9f
commit 2fa11b2168
1 changed files with 40 additions and 0 deletions

View File

@ -212,6 +212,46 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
changesets = @repository.latest_changesets(path, nil)
assert_equal %w|13 12 9|, changesets.collect(&:revision)
end
def test_previous
@repository.fetch_changesets
@repository.reload
%w|26 3ae45e2d177d 3ae4|.each do |r1|
changeset = @repository.find_changeset_by_name(r1)
%w|25 afc61e85bde7 afc6|.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|0 0885933ad4f6 0885|.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|25 afc61e85bde7 afc6|.each do |r2|
changeset = @repository.find_changeset_by_name(r2)
%w|26 3ae45e2d177d 3ae4|.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|26 3ae45e2d177d 3ae4|.each do |r1|
changeset = @repository.find_changeset_by_name(r1)
assert_nil changeset.next
end
end
else
puts "Mercurial test repository NOT FOUND. Skipping unit tests !!!"
def test_fake; assert true end