]> source.dussan.org Git - redmine.git/commitdiff
Fixed that project identifier can always be updated (#11028).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 25 May 2012 16:43:18 +0000 (16:43 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 25 May 2012 16:43:18 +0000 (16:43 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9710 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/project.rb
test/unit/project_test.rb

index a65b5ed036bfc54a6e10d8c75cc5c7c0f4f6a108..aad320b338e15ccfa76cc6f34ce4c2d9ec909c07 100644 (file)
@@ -130,7 +130,7 @@ class Project < ActiveRecord::Base
   end
 
   def identifier_frozen?
-    errors[:identifier].nil? && !(new_record? || identifier.blank?)
+    errors[:identifier].blank? && !(new_record? || identifier.blank?)
   end
 
   # returns latest created projects
index d8f1b1d90d598345a74600eaf7c96469ea62121d..39ed5d058e46460d2b107d223b30fb295783013b 100644 (file)
@@ -106,6 +106,20 @@ class ProjectTest < ActiveSupport::TestCase
     end
   end
 
+  def test_identifier_should_not_be_frozen_for_a_new_project
+    assert_equal false, Project.new.identifier_frozen?
+  end
+
+  def test_identifier_should_not_be_frozen_for_a_saved_project_with_blank_identifier
+    Project.update_all(["identifier = ''"], "id = 1")
+
+    assert_equal false, Project.find(1).identifier_frozen?
+  end
+
+  def test_identifier_should_be_frozen_for_a_saved_project_with_valid_identifier
+    assert_equal true, Project.find(1).identifier_frozen?
+  end
+
   def test_members_should_be_active_users
     Project.all.each do |project|
       assert_nil project.members.detect {|m| !(m.user.is_a?(User) && m.user.active?) }