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
6c7059be
Commit
6c7059be
authored
Feb 18, 2022
by
Jason Goodman
Committed by
Dan Davison
Feb 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update group policy pending membership specs
Test each role rather than just developer
parent
343607b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
15 deletions
+27
-15
ee/spec/policies/group_policy_spec.rb
ee/spec/policies/group_policy_spec.rb
+27
-15
No files found.
ee/spec/policies/group_policy_spec.rb
View file @
6c7059be
...
...
@@ -1812,7 +1812,9 @@ RSpec.describe GroupPolicy do
end
end
describe
'pending memberships'
do
describe
'a pending membership'
do
using
RSpec
::
Parameterized
::
TableSyntax
let_it_be
(
:user
)
{
create
(
:user
)
}
context
'with a private group'
do
...
...
@@ -1820,19 +1822,29 @@ RSpec.describe GroupPolicy do
subject
{
described_class
.
new
(
user
,
private_group
)
}
context
'developer'
do
before
do
create
(
:group_member
,
:awaiting
,
:developer
,
source:
private_group
,
user:
user
)
end
where
(
:role
)
do
Gitlab
::
Access
.
sym_options_with_owner
.
keys
.
map
(
&
:to_sym
)
end
with_them
do
it
'has permission identical to a private group in which the user is not a member'
do
create
(
:group_member
,
:awaiting
,
role
,
source:
private_group
,
user:
user
)
expect_private_group_permissions_as_if_non_member
end
end
context
'with a project in the group'
do
let_it_be
(
:project
)
{
create
(
:project
,
:private
,
namespace:
private_group
)
}
context
'with a project in the group'
do
let_it_be
(
:project
)
{
create
(
:project
,
:private
,
namespace:
private_group
)
}
where
(
:role
)
do
Gitlab
::
Access
.
sym_options_with_owner
.
keys
.
map
(
&
:to_sym
)
end
with_them
do
it
'has permission identical to a private group in which the user is not a member'
do
create
(
:group_member
,
:awaiting
,
role
,
source:
private_group
,
user:
user
)
expect_private_group_permissions_as_if_non_member
end
end
...
...
@@ -1844,12 +1856,14 @@ RSpec.describe GroupPolicy do
subject
{
described_class
.
new
(
user
,
public_group
)
}
context
'developer'
do
before
do
create
(
:group_member
,
:awaiting
,
:developer
,
source:
public_group
,
user:
user
)
end
where
(
:role
)
do
Gitlab
::
Access
.
sym_options_with_owner
.
keys
.
map
(
&
:to_sym
)
end
with_them
do
it
'has permission identical to a public group in which the user is not a member'
do
create
(
:group_member
,
:awaiting
,
role
,
source:
public_group
,
user:
user
)
expect_allowed
(
*
public_permissions
)
expect_disallowed
(
:upload_file
)
expect_disallowed
(
*
reporter_permissions
)
...
...
@@ -1862,8 +1876,6 @@ RSpec.describe GroupPolicy do
end
context
'with a group invited to another group'
do
using
RSpec
::
Parameterized
::
TableSyntax
let_it_be
(
:group
)
{
create
(
:group
,
:public
)
}
let_it_be
(
:other_group
)
{
create
(
:group
,
:private
)
}
...
...
@@ -1874,11 +1886,11 @@ RSpec.describe GroupPolicy do
end
where
(
:role
)
do
%i(owner maintainer developer reporter guest
)
Gitlab
::
Access
.
sym_options_with_owner
.
keys
.
map
(
&
:to_sym
)
end
with_them
do
it
'
a pending member in the group has permissions
to the other group as if the user is not a member'
do
it
'
has permission
to the other group as if the user is not a member'
do
create
(
:group_member
,
:awaiting
,
role
,
source:
group
,
user:
user
)
expect_private_group_permissions_as_if_non_member
...
...
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