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
c49322d4
Commit
c49322d4
authored
Oct 23, 2018
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add project policy specs when repository
This tests permissions when repository is disabled
parent
6669316c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
132 additions
and
0 deletions
+132
-0
ee/spec/policies/project_policy_spec.rb
ee/spec/policies/project_policy_spec.rb
+132
-0
No files found.
ee/spec/policies/project_policy_spec.rb
View file @
c49322d4
...
@@ -368,6 +368,138 @@ describe ProjectPolicy do
...
@@ -368,6 +368,138 @@ describe ProjectPolicy do
end
end
end
end
describe
'read_package'
do
subject
{
described_class
.
new
(
current_user
,
project
)
}
context
'with admin'
do
let
(
:current_user
)
{
admin
}
it
{
is_expected
.
to
be_allowed
(
:read_package
)
}
context
'when repository is disabled'
do
before
do
project
.
project_feature
.
update
(
repository_access_level:
ProjectFeature
::
DISABLED
)
end
it
{
is_expected
.
to
be_disallowed
(
:read_package
)
}
end
end
context
'with owner'
do
let
(
:current_user
)
{
owner
}
it
{
is_expected
.
to
be_allowed
(
:read_package
)
}
end
context
'with maintainer'
do
let
(
:current_user
)
{
maintainer
}
it
{
is_expected
.
to
be_allowed
(
:read_package
)
}
end
context
'with developer'
do
let
(
:current_user
)
{
developer
}
it
{
is_expected
.
to
be_allowed
(
:read_package
)
}
end
context
'with reporter'
do
let
(
:current_user
)
{
reporter
}
it
{
is_expected
.
to
be_allowed
(
:read_package
)
}
end
context
'with guest'
do
let
(
:current_user
)
{
guest
}
it
{
is_expected
.
to
be_allowed
(
:read_package
)
}
end
context
'with non member'
do
let
(
:current_user
)
{
create
(
:user
)
}
it
{
is_expected
.
to
be_allowed
(
:read_package
)
}
end
context
'with anonymous'
do
let
(
:current_user
)
{
nil
}
it
{
is_expected
.
to
be_allowed
(
:read_package
)
}
end
end
describe
'read_feature_flag'
do
before
do
stub_licensed_features
(
feature_flags:
true
)
end
subject
{
described_class
.
new
(
current_user
,
project
)
}
context
'with admin'
do
let
(
:current_user
)
{
admin
}
it
{
is_expected
.
to
be_allowed
(
:read_feature_flag
)
}
context
'when repository is disabled'
do
before
do
project
.
project_feature
.
update
(
repository_access_level:
ProjectFeature
::
DISABLED
)
end
it
{
is_expected
.
to
be_disallowed
(
:read_feature_flag
)
}
end
end
context
'with owner'
do
let
(
:current_user
)
{
owner
}
it
{
is_expected
.
to
be_allowed
(
:read_feature_flag
)
}
end
context
'with maintainer'
do
let
(
:current_user
)
{
maintainer
}
it
{
is_expected
.
to
be_allowed
(
:read_feature_flag
)
}
end
context
'with developer'
do
let
(
:current_user
)
{
developer
}
it
{
is_expected
.
to
be_allowed
(
:read_feature_flag
)
}
context
'when feature flags features is not available'
do
before
do
stub_licensed_features
(
feature_flags:
false
)
end
it
{
is_expected
.
to
be_disallowed
(
:read_feature_flag
)
}
end
end
context
'with reporter'
do
let
(
:current_user
)
{
reporter
}
it
{
is_expected
.
to
be_disallowed
(
:read_feature_flag
)
}
end
context
'with guest'
do
let
(
:current_user
)
{
guest
}
it
{
is_expected
.
to
be_disallowed
(
:read_feature_flag
)
}
end
context
'with non member'
do
let
(
:current_user
)
{
create
(
:user
)
}
it
{
is_expected
.
to
be_disallowed
(
:read_feature_flag
)
}
end
context
'with anonymous'
do
let
(
:current_user
)
{
nil
}
it
{
is_expected
.
to
be_disallowed
(
:read_feature_flag
)
}
end
end
describe
'admin_license_management'
do
describe
'admin_license_management'
do
before
do
before
do
stub_licensed_features
(
license_management:
true
)
stub_licensed_features
(
license_management:
true
)
...
...
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