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
0074e7da
Commit
0074e7da
authored
Nov 27, 2017
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update policies unit tests
parent
609813fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
spec/policies/group_policy_spec.rb
spec/policies/group_policy_spec.rb
+7
-6
spec/policies/namespace_policy_spec.rb
spec/policies/namespace_policy_spec.rb
+7
-3
No files found.
spec/policies/group_policy_spec.rb
View file @
0074e7da
...
@@ -57,6 +57,7 @@ describe GroupPolicy do
...
@@ -57,6 +57,7 @@ describe GroupPolicy do
expect_disallowed
(
*
developer_permissions
)
expect_disallowed
(
*
developer_permissions
)
expect_disallowed
(
*
master_permissions
)
expect_disallowed
(
*
master_permissions
)
expect_disallowed
(
*
owner_permissions
)
expect_disallowed
(
*
owner_permissions
)
expect_disallowed
(
:read_namespace
)
end
end
end
end
...
@@ -64,7 +65,7 @@ describe GroupPolicy do
...
@@ -64,7 +65,7 @@ describe GroupPolicy do
let
(
:current_user
)
{
guest
}
let
(
:current_user
)
{
guest
}
it
do
it
do
expect_allowed
(
:read_group
)
expect_allowed
(
:read_group
,
:read_namespace
)
expect_disallowed
(
*
reporter_permissions
)
expect_disallowed
(
*
reporter_permissions
)
expect_disallowed
(
*
developer_permissions
)
expect_disallowed
(
*
developer_permissions
)
expect_disallowed
(
*
master_permissions
)
expect_disallowed
(
*
master_permissions
)
...
@@ -76,7 +77,7 @@ describe GroupPolicy do
...
@@ -76,7 +77,7 @@ describe GroupPolicy do
let
(
:current_user
)
{
reporter
}
let
(
:current_user
)
{
reporter
}
it
do
it
do
expect_allowed
(
:read_group
)
expect_allowed
(
:read_group
,
:read_namespace
)
expect_allowed
(
*
reporter_permissions
)
expect_allowed
(
*
reporter_permissions
)
expect_disallowed
(
*
developer_permissions
)
expect_disallowed
(
*
developer_permissions
)
expect_disallowed
(
*
master_permissions
)
expect_disallowed
(
*
master_permissions
)
...
@@ -88,7 +89,7 @@ describe GroupPolicy do
...
@@ -88,7 +89,7 @@ describe GroupPolicy do
let
(
:current_user
)
{
developer
}
let
(
:current_user
)
{
developer
}
it
do
it
do
expect_allowed
(
:read_group
)
expect_allowed
(
:read_group
,
:read_namespace
)
expect_allowed
(
*
reporter_permissions
)
expect_allowed
(
*
reporter_permissions
)
expect_allowed
(
*
developer_permissions
)
expect_allowed
(
*
developer_permissions
)
expect_disallowed
(
*
master_permissions
)
expect_disallowed
(
*
master_permissions
)
...
@@ -100,7 +101,7 @@ describe GroupPolicy do
...
@@ -100,7 +101,7 @@ describe GroupPolicy do
let
(
:current_user
)
{
master
}
let
(
:current_user
)
{
master
}
it
do
it
do
expect_allowed
(
:read_group
)
expect_allowed
(
:read_group
,
:read_namespace
)
expect_allowed
(
*
reporter_permissions
)
expect_allowed
(
*
reporter_permissions
)
expect_allowed
(
*
developer_permissions
)
expect_allowed
(
*
developer_permissions
)
expect_allowed
(
*
master_permissions
)
expect_allowed
(
*
master_permissions
)
...
@@ -114,7 +115,7 @@ describe GroupPolicy do
...
@@ -114,7 +115,7 @@ describe GroupPolicy do
it
do
it
do
allow
(
Group
).
to
receive
(
:supports_nested_groups?
).
and_return
(
true
)
allow
(
Group
).
to
receive
(
:supports_nested_groups?
).
and_return
(
true
)
expect_allowed
(
:read_group
)
expect_allowed
(
:read_group
,
:read_namespace
)
expect_allowed
(
*
reporter_permissions
)
expect_allowed
(
*
reporter_permissions
)
expect_allowed
(
*
developer_permissions
)
expect_allowed
(
*
developer_permissions
)
expect_allowed
(
*
master_permissions
)
expect_allowed
(
*
master_permissions
)
...
@@ -128,7 +129,7 @@ describe GroupPolicy do
...
@@ -128,7 +129,7 @@ describe GroupPolicy do
it
do
it
do
allow
(
Group
).
to
receive
(
:supports_nested_groups?
).
and_return
(
true
)
allow
(
Group
).
to
receive
(
:supports_nested_groups?
).
and_return
(
true
)
expect_allowed
(
:read_group
)
expect_allowed
(
:read_group
,
:read_namespace
)
expect_allowed
(
*
reporter_permissions
)
expect_allowed
(
*
reporter_permissions
)
expect_allowed
(
*
developer_permissions
)
expect_allowed
(
*
developer_permissions
)
expect_allowed
(
*
master_permissions
)
expect_allowed
(
*
master_permissions
)
...
...
spec/policies/namespace_policy_spec.rb
View file @
0074e7da
...
@@ -7,9 +7,7 @@ describe NamespacePolicy do
...
@@ -7,9 +7,7 @@ describe NamespacePolicy do
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:namespace
)
{
create
(
:namespace
,
owner:
owner
)
}
let
(
:namespace
)
{
create
(
:namespace
,
owner:
owner
)
}
let
(
:owner_permissions
)
{
[
:create_projects
,
:admin_namespace
]
}
let
(
:owner_permissions
)
{
[
:create_projects
,
:admin_namespace
,
:read_namespace
]
}
let
(
:admin_permissions
)
{
owner_permissions
}
subject
{
described_class
.
new
(
current_user
,
namespace
)
}
subject
{
described_class
.
new
(
current_user
,
namespace
)
}
...
@@ -29,6 +27,12 @@ describe NamespacePolicy do
...
@@ -29,6 +27,12 @@ describe NamespacePolicy do
let
(
:current_user
)
{
owner
}
let
(
:current_user
)
{
owner
}
it
{
is_expected
.
to
be_allowed
(
*
owner_permissions
)
}
it
{
is_expected
.
to
be_allowed
(
*
owner_permissions
)
}
context
'user who has exceeded project limit'
do
let
(
:owner
)
{
create
(
:user
,
projects_limit:
0
)
}
it
{
is_expected
.
to
be_disallowed
(
:create_projects
)
}
end
end
end
context
'auditor'
do
context
'auditor'
do
...
...
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