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
30a4e553
Commit
30a4e553
authored
Mar 19, 2019
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CE] Reduce differences with EE in group_projects_finder_spec.rb
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
284d3e56
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
20 deletions
+43
-20
spec/finders/group_projects_finder_spec.rb
spec/finders/group_projects_finder_spec.rb
+19
-20
spec/support/shared_contexts/finders/group_projects_finder_shared_contexts.rb
...contexts/finders/group_projects_finder_shared_contexts.rb
+24
-0
No files found.
spec/finders/group_projects_finder_spec.rb
View file @
30a4e553
require
'spec_helper'
require
'spec_helper'
describe
GroupProjectsFinder
do
describe
GroupProjectsFinder
do
let
(
:group
)
{
create
(
:group
)
}
include_context
'GroupProjectsFinder context'
let
(
:subgroup
)
{
create
(
:group
,
parent:
group
)
}
let
(
:current_user
)
{
create
(
:user
)
}
let
(
:options
)
{
{}
}
let
(
:finder
)
{
described_class
.
new
(
group:
group
,
current_user:
current_user
,
options:
options
)
}
let!
(
:public_project
)
{
create
(
:project
,
:public
,
group:
group
,
path:
'1'
)
}
let!
(
:private_project
)
{
create
(
:project
,
:private
,
group:
group
,
path:
'2'
)
}
let!
(
:shared_project_1
)
{
create
(
:project
,
:public
,
path:
'3'
)
}
let!
(
:shared_project_2
)
{
create
(
:project
,
:private
,
path:
'4'
)
}
let!
(
:shared_project_3
)
{
create
(
:project
,
:internal
,
path:
'5'
)
}
let!
(
:subgroup_project
)
{
create
(
:project
,
:public
,
path:
'6'
,
group:
subgroup
)
}
let!
(
:subgroup_private_project
)
{
create
(
:project
,
:private
,
path:
'7'
,
group:
subgroup
)
}
before
do
shared_project_1
.
project_group_links
.
create
(
group_access:
Gitlab
::
Access
::
MAINTAINER
,
group:
group
)
shared_project_2
.
project_group_links
.
create
(
group_access:
Gitlab
::
Access
::
MAINTAINER
,
group:
group
)
shared_project_3
.
project_group_links
.
create
(
group_access:
Gitlab
::
Access
::
MAINTAINER
,
group:
group
)
end
subject
{
finder
.
execute
}
subject
{
finder
.
execute
}
...
@@ -144,6 +125,24 @@ describe GroupProjectsFinder do
...
@@ -144,6 +125,24 @@ describe GroupProjectsFinder do
end
end
end
end
describe
'with an admin current user'
do
let
(
:current_user
)
{
create
(
:admin
)
}
context
"only shared"
do
let
(
:options
)
{
{
only_shared:
true
}
}
it
{
is_expected
.
to
eq
([
shared_project_3
,
shared_project_2
,
shared_project_1
])
}
end
context
"only owned"
do
let
(
:options
)
{
{
only_owned:
true
}
}
it
{
is_expected
.
to
eq
([
private_project
,
public_project
])
}
end
context
"all"
do
it
{
is_expected
.
to
eq
([
shared_project_3
,
shared_project_2
,
shared_project_1
,
private_project
,
public_project
])
}
end
end
describe
"no user"
do
describe
"no user"
do
context
"only shared"
do
context
"only shared"
do
let
(
:options
)
{
{
only_shared:
true
}
}
let
(
:options
)
{
{
only_shared:
true
}
}
...
...
spec/support/shared_contexts/finders/group_projects_finder_shared_contexts.rb
0 → 100644
View file @
30a4e553
require
'spec_helper'
RSpec
.
shared_context
'GroupProjectsFinder context'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:subgroup
)
{
create
(
:group
,
parent:
group
)
}
let
(
:current_user
)
{
create
(
:user
)
}
let
(
:options
)
{
{}
}
let
(
:finder
)
{
described_class
.
new
(
group:
group
,
current_user:
current_user
,
options:
options
)
}
let!
(
:public_project
)
{
create
(
:project
,
:public
,
group:
group
,
path:
'1'
)
}
let!
(
:private_project
)
{
create
(
:project
,
:private
,
group:
group
,
path:
'2'
)
}
let!
(
:shared_project_1
)
{
create
(
:project
,
:public
,
path:
'3'
)
}
let!
(
:shared_project_2
)
{
create
(
:project
,
:private
,
path:
'4'
)
}
let!
(
:shared_project_3
)
{
create
(
:project
,
:internal
,
path:
'5'
)
}
let!
(
:subgroup_project
)
{
create
(
:project
,
:public
,
path:
'6'
,
group:
subgroup
)
}
let!
(
:subgroup_private_project
)
{
create
(
:project
,
:private
,
path:
'7'
,
group:
subgroup
)
}
before
do
shared_project_1
.
project_group_links
.
create
(
group_access:
Gitlab
::
Access
::
MAINTAINER
,
group:
group
)
shared_project_2
.
project_group_links
.
create
(
group_access:
Gitlab
::
Access
::
MAINTAINER
,
group:
group
)
shared_project_3
.
project_group_links
.
create
(
group_access:
Gitlab
::
Access
::
MAINTAINER
,
group:
group
)
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