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
5390b669
Commit
5390b669
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 project policy pending membership specs
Test each role rather than only developer
parent
b236eb2c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
9 deletions
+45
-9
ee/spec/policies/project_policy_spec.rb
ee/spec/policies/project_policy_spec.rb
+45
-9
No files found.
ee/spec/policies/project_policy_spec.rb
View file @
5390b669
...
...
@@ -1963,9 +1963,27 @@ RSpec.describe ProjectPolicy do
end
describe
'pending member permissions'
do
using
RSpec
::
Parameterized
::
TableSyntax
let_it_be
(
:current_user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
,
:public
)
}
context
'with a pending membership in a private project'
do
let_it_be
(
:project
)
{
create
(
:project
,
:private
,
public_builds:
false
)
}
where
(
:role
)
do
Gitlab
::
Access
.
sym_options
.
keys
.
map
(
&
:to_sym
)
end
with_them
do
it
'a pending member has permissions to the project as if the user is not a member'
do
create
(
:project_member
,
:awaiting
,
role
,
source:
project
,
user:
current_user
)
expect_private_project_permissions_as_if_non_member
end
end
end
context
'with a group invited to a project'
do
let_it_be
(
:project
)
{
create
(
:project
,
:private
,
public_builds:
false
)
}
...
...
@@ -1973,10 +1991,16 @@ RSpec.describe ProjectPolicy do
create
(
:project_group_link
,
project:
project
,
group:
group
)
end
it
'a pending developer in the group has permissions to the project as if the user is not a member'
do
create
(
:group_member
,
:awaiting
,
:developer
,
source:
group
,
user:
current_user
)
where
(
:role
)
do
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 project as if the user is not a member'
do
create
(
:group_member
,
:awaiting
,
role
,
source:
group
,
user:
current_user
)
expect_private_project_permissions_as_if_non_member
expect_private_project_permissions_as_if_non_member
end
end
end
...
...
@@ -1988,10 +2012,16 @@ RSpec.describe ProjectPolicy do
create
(
:group_group_link
,
shared_with_group:
group
,
shared_group:
other_group
)
end
it
"a pending developer in the group has permissions to the other group's project as if the user is not a member"
do
create
(
:group_member
,
:awaiting
,
:developer
,
source:
group
,
user:
current_user
)
where
(
:role
)
do
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's project as if the user is not a member"
do
create
(
:group_member
,
:awaiting
,
role
,
source:
group
,
user:
current_user
)
expect_private_project_permissions_as_if_non_member
expect_private_project_permissions_as_if_non_member
end
end
end
...
...
@@ -1999,10 +2029,16 @@ RSpec.describe ProjectPolicy do
let_it_be
(
:subgroup
)
{
create
(
:group
,
:private
,
parent:
group
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:private
,
public_builds:
false
,
namespace:
subgroup
)
}
it
'a pending developer in the group has permissions to the subgroup project as if the user is not a member'
do
create
(
:group_member
,
:awaiting
,
:developer
,
source:
group
,
user:
current_user
)
where
(
:role
)
do
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 subgroup project as if the user is not a member'
do
create
(
:group_member
,
:awaiting
,
role
,
source:
group
,
user:
current_user
)
expect_private_project_permissions_as_if_non_member
expect_private_project_permissions_as_if_non_member
end
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