summaryrefslogtreecommitdiffstats
path: root/test/unit/project_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-11-15 13:22:08 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-11-15 13:22:08 +0000
commit534ce51154c55078a611a098b225b6d0c9f8653f (patch)
tree11c49f42d856092734a3e0c9a9cf3f7219168a12 /test/unit/project_test.rb
parentea9a7c20e66032a79f07b197090aedfb97c5bef6 (diff)
downloadredmine-534ce51154c55078a611a098b225b6d0c9f8653f.tar.gz
redmine-534ce51154c55078a611a098b225b6d0c9f8653f.zip
Allow non admin users to add subprojects (#2963).
Subprojects can be added to the projects for which the user has add_project permission. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3059 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/project_test.rb')
-rw-r--r--test/unit/project_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb
index 2c1d2601a..b4bb4cc11 100644
--- a/test/unit/project_test.rb
+++ b/test/unit/project_test.rb
@@ -26,6 +26,7 @@ class ProjectTest < ActiveSupport::TestCase
def setup
@ecookbook = Project.find(1)
@ecookbook_sub1 = Project.find(3)
+ User.current = nil
end
should_validate_presence_of :name
@@ -236,6 +237,14 @@ class ProjectTest < ActiveSupport::TestCase
assert_equal [5, 6, 3, 4], d.collect(&:id)
end
+ def test_allowed_parents_should_be_empty_for_non_member_user
+ Role.non_member.add_permission!(:add_project)
+ user = User.find(9)
+ assert user.memberships.empty?
+ User.current = user
+ assert Project.new.allowed_parents.empty?
+ end
+
def test_users_by_role
users_by_role = Project.find(1).users_by_role
assert_kind_of Hash, users_by_role