diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-06-25 17:49:35 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-06-25 17:49:35 +0000 |
commit | ac56c0c99ccd14c7229145fc22d6e9eb13ee0af0 (patch) | |
tree | f54401b77f7195a1795f4a189f9f9d35734c0a2b /test/unit | |
parent | 5961a1e70d1efdfb5c4fd28c20dc8cc4d9a51bac (diff) | |
download | redmine-ac56c0c99ccd14c7229145fc22d6e9eb13ee0af0.tar.gz redmine-ac56c0c99ccd14c7229145fc22d6e9eb13ee0af0.zip |
Ability to close projects (read-only) (#3640).
A new permission (Close/reopen project) is available to give non-admin users the ability to close their projects.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9883 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/lib/redmine/access_control_test.rb | 10 | ||||
-rw-r--r-- | test/unit/user_test.rb | 12 |
2 files changed, 22 insertions, 0 deletions
diff --git a/test/unit/lib/redmine/access_control_test.rb b/test/unit/lib/redmine/access_control_test.rb index 94c83e179..7c0f85475 100644 --- a/test/unit/lib/redmine/access_control_test.rb +++ b/test/unit/lib/redmine/access_control_test.rb @@ -46,4 +46,14 @@ class Redmine::AccessControlTest < ActiveSupport::TestCase assert perm.actions.is_a?(Array) assert perm.actions.include?('projects/settings') end + + def test_read_action_should_return_true_for_read_actions + assert_equal true, @access_module.read_action?(:view_project) + assert_equal true, @access_module.read_action?(:controller => 'projects', :action => 'show') + end + + def test_read_action_should_return_false_for_update_actions + assert_equal false, @access_module.read_action?(:edit_project) + assert_equal false, @access_module.read_action?(:controller => 'projects', :action => 'edit') + end end diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index 2ff55f9f3..51a49de01 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -874,6 +874,18 @@ class UserTest < ActiveSupport::TestCase assert ! @admin.allowed_to?(:view_issues, Project.find(1)) end + should "return false for write action if project is closed" do + project = Project.find(1) + Project.any_instance.stubs(:status).returns(Project::STATUS_CLOSED) + assert ! @admin.allowed_to?(:edit_project, Project.find(1)) + end + + should "return true for read action if project is closed" do + project = Project.find(1) + Project.any_instance.stubs(:status).returns(Project::STATUS_CLOSED) + assert @admin.allowed_to?(:view_project, Project.find(1)) + end + should "return false if related module is disabled" do project = Project.find(1) project.enabled_module_names = ["issue_tracking"] |