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
a089f4f4
Commit
a089f4f4
authored
Jun 28, 2017
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert ee policy specs
parent
268157f9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
29 deletions
+28
-29
spec/policies/ee/group_policy_spec.rb
spec/policies/ee/group_policy_spec.rb
+10
-10
spec/policies/group_policy_spec.rb
spec/policies/group_policy_spec.rb
+3
-4
spec/policies/namespace_policy_spec.rb
spec/policies/namespace_policy_spec.rb
+7
-7
spec/policies/project_policy_spec.rb
spec/policies/project_policy_spec.rb
+4
-4
spec/policies/project_snippet_policy_spec.rb
spec/policies/project_snippet_policy_spec.rb
+4
-4
No files found.
spec/policies/ee/group_policy_spec.rb
View file @
a089f4f4
...
...
@@ -18,19 +18,19 @@ describe GroupPolicy, models: true do
group
.
add_owner
(
owner
)
end
subject
{
described_class
.
abilities
(
current_user
,
group
).
to_set
}
subject
{
described_class
.
new
(
current_user
,
group
)
}
context
'when LDAP sync is not enabled'
do
context
'owner'
do
let
(
:current_user
)
{
owner
}
it
{
is_expected
.
not_to
include
(
:override_group_member
)
}
it
{
is_expected
.
to
be_disallowed
(
:override_group_member
)
}
end
context
'admin'
do
let
(
:current_user
)
{
admin
}
it
{
is_expected
.
not_to
include
(
:override_group_member
)
}
it
{
is_expected
.
to
be_disallowed
(
:override_group_member
)
}
end
end
...
...
@@ -42,43 +42,43 @@ describe GroupPolicy, models: true do
context
'with no user'
do
let
(
:current_user
)
{
nil
}
it
{
is_expected
.
not_to
include
(
:override_group_member
)
}
it
{
is_expected
.
to
be_disallowed
(
:override_group_member
)
}
end
context
'guests'
do
let
(
:current_user
)
{
guest
}
it
{
is_expected
.
not_to
include
(
:override_group_member
)
}
it
{
is_expected
.
to
be_disallowed
(
:override_group_member
)
}
end
context
'reporter'
do
let
(
:current_user
)
{
reporter
}
it
{
is_expected
.
not_to
include
(
:override_group_member
)
}
it
{
is_expected
.
to
be_disallowed
(
:override_group_member
)
}
end
context
'developer'
do
let
(
:current_user
)
{
developer
}
it
{
is_expected
.
not_to
include
(
:override_group_member
)
}
it
{
is_expected
.
to
be_disallowed
(
:override_group_member
)
}
end
context
'master'
do
let
(
:current_user
)
{
master
}
it
{
is_expected
.
not_to
include
(
:override_group_member
)
}
it
{
is_expected
.
to
be_disallowed
(
:override_group_member
)
}
end
context
'owner'
do
let
(
:current_user
)
{
owner
}
it
{
is_expected
.
to
include
(
:override_group_member
)
}
it
{
is_expected
.
to
be_allowed
(
:override_group_member
)
}
end
context
'admin'
do
let
(
:current_user
)
{
admin
}
it
{
is_expected
.
to
include
(
:override_group_member
)
}
it
{
is_expected
.
to
be_allowed
(
:override_group_member
)
}
end
end
end
spec/policies/group_policy_spec.rb
View file @
a089f4f4
...
...
@@ -211,10 +211,9 @@ describe GroupPolicy, models: true do
let
(
:current_user
)
{
auditor
}
it
do
is_expected
.
to
include
(
:read_group
)
is_expected
.
to
all
(
start_with
(
"read"
))
is_expected
.
not_to
include
(
*
master_permissions
)
is_expected
.
not_to
include
(
*
owner_permissions
)
is_expected
.
to
be_allowed
(
:read_group
)
is_expected
.
to
be_disallowed
(
*
master_permissions
)
is_expected
.
to
be_disallowed
(
*
owner_permissions
)
end
end
end
...
...
spec/policies/namespace_policy_spec.rb
View file @
a089f4f4
...
...
@@ -11,24 +11,24 @@ describe NamespacePolicy, models: true do
let
(
:admin_permissions
)
{
owner_permissions
}
subject
{
described_class
.
abilities
(
current_user
,
namespace
).
to_set
}
subject
{
described_class
.
new
(
current_user
,
namespace
)
}
context
'with no user'
do
let
(
:current_user
)
{
nil
}
it
{
is_expected
.
to
be_
empty
}
it
{
is_expected
.
to
be_
banned
}
end
context
'regular user'
do
let
(
:current_user
)
{
user
}
it
{
is_expected
.
to
be_
empty
}
it
{
is_expected
.
to
be_
disallowed
(
*
owner_permissions
)
}
end
context
'owner'
do
let
(
:current_user
)
{
owner
}
it
{
is_expected
.
to
include
(
*
owner_permissions
)
}
it
{
is_expected
.
to
be_allowed
(
*
owner_permissions
)
}
end
context
'auditor'
do
...
...
@@ -37,17 +37,17 @@ describe NamespacePolicy, models: true do
context
'owner'
do
let
(
:namespace
)
{
create
(
:namespace
,
owner:
auditor
)
}
it
{
is_expected
.
to
include
(
*
owner_permissions
)
}
it
{
is_expected
.
to
be_allowed
(
*
owner_permissions
)
}
end
context
'non-owner'
do
it
{
is_expected
.
to
be_
empty
}
it
{
is_expected
.
to
be_
disallowed
(
*
owner_permissions
)
}
end
end
context
'admin'
do
let
(
:current_user
)
{
admin
}
it
{
is_expected
.
to
include
(
*
owner_permissions
)
}
it
{
is_expected
.
to
be_allowed
(
*
owner_permissions
)
}
end
end
spec/policies/project_policy_spec.rb
View file @
a089f4f4
...
...
@@ -243,10 +243,10 @@ describe ProjectPolicy, models: true do
let
(
:current_user
)
{
auditor
}
it
do
is_expected
.
not_to
include
(
*
developer_permissions
)
is_expected
.
not_to
include
(
*
master_permissions
)
is_expected
.
not_to
include
(
*
owner_permissions
)
is_expected
.
to
include
(
*
auditor_permissions
)
is_expected
.
to
be_disallowed
(
*
developer_permissions
)
is_expected
.
to
be_disallowed
(
*
master_permissions
)
is_expected
.
to
be_disallowed
(
*
owner_permissions
)
is_expected
.
to
be_allowed
(
*
auditor_permissions
)
end
end
end
...
...
spec/policies/project_snippet_policy_spec.rb
View file @
a089f4f4
...
...
@@ -101,8 +101,8 @@ describe ProjectSnippetPolicy, models: true do
subject
{
abilities
(
current_user
,
:private
)
}
it
do
is_expected
.
not_to
include
(
:read_project_snippet
)
is_expected
.
not_to
include
(
*
author_permissions
)
is_expected
.
to
be_disallowed
(
:read_project_snippet
)
is_expected
.
to
be_disallowed
(
*
author_permissions
)
end
end
end
...
...
@@ -168,8 +168,8 @@ describe ProjectSnippetPolicy, models: true do
subject
{
abilities
(
current_user
,
:private
)
}
it
do
is_expected
.
to
include
(
:read_project_snippet
)
is_expected
.
not_to
include
(
*
author_permissions
)
is_expected
.
to
be_allowed
(
:read_project_snippet
)
is_expected
.
to
be_disallowed
(
*
author_permissions
)
end
end
...
...
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