Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
42c33268
Commit
42c33268
authored
Nov 29, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve ProjectPolicy spec to check permissions when wiki is disabled
parent
d6b9b21e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
spec/policies/project_policy_spec.rb
spec/policies/project_policy_spec.rb
+12
-2
No files found.
spec/policies/project_policy_spec.rb
View file @
42c33268
...
@@ -23,7 +23,7 @@ describe ProjectPolicy, models: true do
...
@@ -23,7 +23,7 @@ describe ProjectPolicy, models: true do
:download_code
,
:fork_project
,
:create_project_snippet
,
:update_issue
,
:download_code
,
:fork_project
,
:create_project_snippet
,
:update_issue
,
:admin_issue
,
:admin_label
,
:admin_list
,
:read_commit_status
,
:read_build
,
:admin_issue
,
:admin_label
,
:admin_list
,
:read_commit_status
,
:read_build
,
:read_container_image
,
:read_pipeline
,
:read_environment
,
:read_deployment
,
:read_container_image
,
:read_pipeline
,
:read_environment
,
:read_deployment
,
:read_merge_request
:read_merge_request
,
:download_wiki_code
]
]
end
end
...
@@ -56,7 +56,8 @@ describe ProjectPolicy, models: true do
...
@@ -56,7 +56,8 @@ describe ProjectPolicy, models: true do
let
(
:public_permissions
)
do
let
(
:public_permissions
)
do
[
[
:download_code
,
:fork_project
,
:read_commit_status
,
:read_pipeline
,
:download_code
,
:fork_project
,
:read_commit_status
,
:read_pipeline
,
:read_container_image
,
:build_download_code
,
:build_read_container_image
:read_container_image
,
:build_download_code
,
:build_read_container_image
,
:download_wiki_code
]
]
end
end
...
@@ -87,6 +88,15 @@ describe ProjectPolicy, models: true do
...
@@ -87,6 +88,15 @@ describe ProjectPolicy, models: true do
expect
(
Ability
.
allowed?
(
user
,
:read_issue
,
project
)).
to
be_falsy
expect
(
Ability
.
allowed?
(
user
,
:read_issue
,
project
)).
to
be_falsy
end
end
it
'does not include the wiki permissions when the feature is disabled'
do
project
.
project_feature
.
update_attribute
(
:wiki_access_level
,
ProjectFeature
::
DISABLED
)
wiki_permissions
=
[
:read_wiki
,
:create_wiki
,
:update_wiki
,
:admin_wiki
,
:download_wiki_code
]
permissions
=
described_class
.
abilities
(
owner
,
project
).
to_set
expect
(
permissions
).
not_to
include
(
*
wiki_permissions
)
end
context
'abilities for non-public projects'
do
context
'abilities for non-public projects'
do
let
(
:project
)
{
create
(
:empty_project
,
namespace:
owner
.
namespace
)
}
let
(
:project
)
{
create
(
:empty_project
,
namespace:
owner
.
namespace
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment