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
59672bed
Commit
59672bed
authored
Oct 14, 2020
by
Corinna Wiesner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for user namespace and refactor specs
parent
5ee6d0fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
18 deletions
+24
-18
spec/models/namespace_spec.rb
spec/models/namespace_spec.rb
+24
-18
No files found.
spec/models/namespace_spec.rb
View file @
59672bed
...
@@ -855,42 +855,48 @@ RSpec.describe Namespace do
...
@@ -855,42 +855,48 @@ RSpec.describe Namespace do
end
end
describe
'#all_projects'
do
describe
'#all_projects'
do
let
(
:namespace
)
{
create
(
:namespace
)
}
let
(
:child
)
{
create
(
:group
,
parent:
namespace
)
}
let!
(
:project1
)
{
create
(
:project_empty_repo
,
namespace:
namespace
)
}
let!
(
:project2
)
{
create
(
:project_empty_repo
,
namespace:
child
)
}
shared_examples
'all projects for a namespace'
do
shared_examples
'all projects for a namespace'
do
let
(
:namespace
)
{
create
(
:namespace
)
}
let
(
:child
)
{
create
(
:group
,
parent:
namespace
)
}
let!
(
:project1
)
{
create
(
:project_empty_repo
,
namespace:
namespace
)
}
let!
(
:project2
)
{
create
(
:project_empty_repo
,
namespace:
child
)
}
it
{
expect
(
namespace
.
all_projects
.
to_a
).
to
match_array
([
project2
,
project1
])
}
it
{
expect
(
namespace
.
all_projects
.
to_a
).
to
match_array
([
project2
,
project1
])
}
it
{
expect
(
child
.
all_projects
.
to_a
).
to
match_array
([
project2
])
}
it
{
expect
(
child
.
all_projects
.
to_a
).
to
match_array
([
project2
])
}
end
end
context
'with recursive approach'
do
shared_examples
'all project examples'
do
before
do
stub_feature_flags
(
recursive_approach_for_all_projects:
true
)
end
include_examples
'all projects for a namespace'
include_examples
'all projects for a namespace'
context
'when namespace is a group'
do
context
'when namespace is a group'
do
let
(
:namespace
)
{
create
(
:group
)
}
let
_it_be
(
:namespace
)
{
create
(
:group
)
}
include_examples
'all projects for a namespace'
include_examples
'all projects for a namespace'
end
end
context
'when namespace is a user namespace'
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user_namespace
)
{
create
(
:namespace
,
owner:
user
)
}
let_it_be
(
:project
)
{
create
(
:project
,
namespace:
user_namespace
)
}
it
{
expect
(
user_namespace
.
all_projects
.
to_a
).
to
match_array
([
project
])
}
end
end
end
context
'with r
oute path wildcard
approach'
do
context
'with r
ecursive
approach'
do
before
do
before
do
stub_feature_flags
(
recursive_approach_for_all_projects:
fals
e
)
stub_feature_flags
(
recursive_approach_for_all_projects:
tru
e
)
end
end
include_examples
'all projects for a namespace'
include_examples
'all project examples'
end
context
'when namespace is a group'
do
let_it_be
(
:namespace
)
{
create
(
:group
)
}
include_examples
'all projects for a namespace'
context
'with route path wildcard approach'
do
before
do
stub_feature_flags
(
recursive_approach_for_all_projects:
false
)
end
end
include_examples
'all project examples'
end
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