scm: git: fix incorrect comment in unit model test and code clean up unit model test.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5722 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-05-09 15:26:50 +00:00
parent b97087bad5
commit f3a069281e
1 changed files with 15 additions and 6 deletions

View File

@ -78,13 +78,19 @@ class RepositoryGitTest < ActiveSupport::TestCase
def test_fetch_changesets_incremental def test_fetch_changesets_incremental
@repository.fetch_changesets @repository.fetch_changesets
# Remove the 3 latest changesets
@repository.changesets.find(:all, :order => 'committed_on DESC', :limit => 8).each(&:destroy) # Remove the latest changesets
@repository.changesets.find(
:all,
:order => 'committed_on DESC',
:limit => 8).each(&:destroy)
@repository.reload @repository.reload
cs1 = @repository.changesets cs1 = @repository.changesets
assert_equal 13, cs1.count assert_equal 13, cs1.count
rev_a_commit = @repository.changesets.find(:first, :order => 'committed_on DESC') rev_a_commit = @repository.changesets.find(
:first,
:order => 'committed_on DESC')
assert_equal '4f26664364207fa8b1af9f8722647ab2d4ac5d43', rev_a_commit.revision assert_equal '4f26664364207fa8b1af9f8722647ab2d4ac5d43', rev_a_commit.revision
# Mon Jul 5 22:34:26 2010 +0200 # Mon Jul 5 22:34:26 2010 +0200
rev_a_committed_on = Time.gm(2010, 7, 5, 20, 34, 26) rev_a_committed_on = Time.gm(2010, 7, 5, 20, 34, 26)
@ -243,14 +249,16 @@ class RepositoryGitTest < ActiveSupport::TestCase
def test_identifier def test_identifier
@repository.fetch_changesets @repository.fetch_changesets
@repository.reload @repository.reload
c = @repository.changesets.find_by_revision('7234cb2750b63f47bff735edc50a1c0a433c2518') c = @repository.changesets.find_by_revision(
'7234cb2750b63f47bff735edc50a1c0a433c2518')
assert_equal c.scmid, c.identifier assert_equal c.scmid, c.identifier
end end
def test_format_identifier def test_format_identifier
@repository.fetch_changesets @repository.fetch_changesets
@repository.reload @repository.reload
c = @repository.changesets.find_by_revision('7234cb2750b63f47bff735edc50a1c0a433c2518') c = @repository.changesets.find_by_revision(
'7234cb2750b63f47bff735edc50a1c0a433c2518')
assert_equal '7234cb27', c.format_identifier assert_equal '7234cb27', c.format_identifier
end end
@ -271,7 +279,8 @@ class RepositoryGitTest < ActiveSupport::TestCase
if str_felix_hex.respond_to?(:force_encoding) if str_felix_hex.respond_to?(:force_encoding)
str_felix_hex.force_encoding('UTF-8') str_felix_hex.force_encoding('UTF-8')
end end
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