summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-05-26 09:50:51 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-05-26 09:50:51 +0000
commit035bd65a5a02d7112cc44dac71a2e493e07629f8 (patch)
treefc139e37b589b86da831c4378df71d0c0bc84128
parent955d2b134d3b34f4f94f3f8a2e79676181fb3e05 (diff)
downloadredmine-035bd65a5a02d7112cc44dac71a2e493e07629f8.tar.gz
redmine-035bd65a5a02d7112cc44dac71a2e493e07629f8.zip
Merged r9710 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.0-stable@9725 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/project.rb2
-rw-r--r--test/unit/project_test.rb14
2 files changed, 15 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index a65b5ed03..aad320b33 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -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
diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb
index d8f1b1d90..39ed5d058 100644
--- a/test/unit/project_test.rb
+++ b/test/unit/project_test.rb
@@ -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?) }