Fixed that Repository#entries returns an Array.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9804 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-06-10 17:01:33 +00:00
parent 4d12bea397
commit 9b60214b3a
8 changed files with 29 additions and 2 deletions

View File

@ -278,7 +278,7 @@ module Redmine
class Entries < Array class Entries < Array
def sort_by_name def sort_by_name
sort {|x,y| dup.sort! {|x,y|
if x.kind == y.kind if x.kind == y.kind
x.name.to_s <=> y.name.to_s x.name.to_s <=> y.name.to_s
else else

View File

@ -88,6 +88,7 @@ class RepositoryBazaarTest < ActiveSupport::TestCase
def test_entries def test_entries
entries = @repository.entries entries = @repository.entries
assert_kind_of Redmine::Scm::Adapters::Entries, entries
assert_equal 2, entries.size assert_equal 2, entries.size
assert_equal 'dir', entries[0].kind assert_equal 'dir', entries[0].kind

View File

@ -158,6 +158,7 @@ class RepositoryCvsTest < ActiveSupport::TestCase
@project.reload @project.reload
assert_equal CHANGESETS_NUM, @repository.changesets.count assert_equal CHANGESETS_NUM, @repository.changesets.count
entries = @repository.entries('', '3') entries = @repository.entries('', '3')
assert_kind_of Redmine::Scm::Adapters::Entries, entries
assert_equal 3, entries.size assert_equal 3, entries.size
assert_equal entries[2].name, "README" assert_equal entries[2].name, "README"
assert_equal entries[2].lastrev.time, Time.gm(2007, 12, 13, 16, 27, 22) assert_equal entries[2].lastrev.time, Time.gm(2007, 12, 13, 16, 27, 22)

View File

@ -88,6 +88,11 @@ class RepositoryDarcsTest < ActiveSupport::TestCase
assert_equal NUM_REV, @repository.changesets.count assert_equal NUM_REV, @repository.changesets.count
end end
def test_entries
entries = @repository.entries
assert_kind_of Redmine::Scm::Adapters::Entries, entries
end
def test_entries_invalid_revision def test_entries_invalid_revision
assert_equal 0, @repository.changesets.count assert_equal 0, @repository.changesets.count
@repository.fetch_changesets @repository.fetch_changesets

View File

@ -70,7 +70,12 @@ class RepositoryFilesystemTest < ActiveSupport::TestCase
end end
def test_entries def test_entries
assert_equal 3, @repository.entries("", 2).size entries = @repository.entries("", 2)
assert_kind_of Redmine::Scm::Adapters::Entries, entries
assert_equal 3, entries.size
end
def test_entries_in_directory
assert_equal 2, @repository.entries("dir", 3).size assert_equal 2, @repository.entries("dir", 3).size
end end

View File

@ -97,6 +97,11 @@ class RepositoryGitTest < ActiveSupport::TestCase
assert_equal true, klass.scm_available assert_equal true, klass.scm_available
end end
def test_entries
entries = @repository.entries
assert_kind_of Redmine::Scm::Adapters::Entries, entries
end
def test_fetch_changesets_from_scratch def test_fetch_changesets_from_scratch
assert_nil @repository.extra_info assert_nil @repository.extra_info

View File

@ -81,6 +81,11 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
assert_equal true, klass.scm_available assert_equal true, klass.scm_available
end end
def test_entries
entries = @repository.entries
assert_kind_of Redmine::Scm::Adapters::Entries, entries
end
def test_fetch_changesets_from_scratch def test_fetch_changesets_from_scratch
assert_equal 0, @repository.changesets.count assert_equal 0, @repository.changesets.count
@repository.fetch_changesets @repository.fetch_changesets

View File

@ -56,6 +56,11 @@ class RepositorySubversionTest < ActiveSupport::TestCase
assert_equal NUM_REV, @repository.changesets.count assert_equal NUM_REV, @repository.changesets.count
end end
def test_entries
entries = @repository.entries
assert_kind_of Redmine::Scm::Adapters::Entries, entries
end
def test_latest_changesets def test_latest_changesets
assert_equal 0, @repository.changesets.count assert_equal 0, @repository.changesets.count
@repository.fetch_changesets @repository.fetch_changesets