diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/user_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index f3e56ddd3..b451c1e6b 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -396,6 +396,19 @@ class UserTest < ActiveSupport::TestCase assert ! @dlopper.allowed_to?(:delete_messages, project) #Developper end end + + context "with multiple projects" do + should "return false if array is empty" do + assert ! @admin.allowed_to?(:view_project, []) + end + + should "return true only if user has permission on all these projects" do + assert @admin.allowed_to?(:view_project, Project.all) + assert ! @dlopper.allowed_to?(:view_project, Project.all) #cannot see Project(2) + assert @jsmith.allowed_to?(:edit_issues, @jsmith.projects) #Manager or Developer everywhere + assert ! @jsmith.allowed_to?(:delete_issue_watchers, @jsmith.projects) #Dev cannot delete_issue_watchers + end + end context "with options[:global]" do should "authorize if user has at least one role that has this permission" do |