]> source.dussan.org Git - redmine.git/commitdiff
Merged r9619 from trunk.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 4 May 2012 16:58:08 +0000 (16:58 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 4 May 2012 16:58:08 +0000 (16:58 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@9620 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/repository.rb
test/unit/repository_test.rb

index 5b1d681115cfbf1a597919a790c9fa5be96f8067..e3e67505a3f150c0b8ca54b8782a5b48d706e944 100644 (file)
@@ -141,7 +141,7 @@ class Repository < ActiveRecord::Base
     elsif repository.is_default?
       1
     else
-      identifier <=> repository.identifier
+      identifier.to_s <=> repository.identifier.to_s
     end
   end
 
index 1fe246d8e3f589f7619e413dff84aa2cb1e7cf3a..466babb3851d3e56541d60ed85be41b3ed9df752 100644 (file)
@@ -318,4 +318,13 @@ class RepositoryTest < ActiveSupport::TestCase
     assert_equal "test_value_23",
                  repo.extra_info["test_2"]["test_23"]
   end
+
+  def test_sort_should_not_raise_an_error_with_nil_identifiers
+    r1 = Repository.new
+    r2 = Repository.new
+
+    assert_nothing_raised do
+      [r1, r2].sort
+    end
+  end
 end