From 534ce51154c55078a611a098b225b6d0c9f8653f Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 15 Nov 2009 13:22:08 +0000 Subject: 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 --- test/unit/project_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/unit/project_test.rb') 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 -- cgit v1.2.3