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
Show 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
end
describe
'#all_projects'
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
)
}
shared_examples
'all projects for a namespace'
do
it
{
expect
(
namespace
.
all_projects
.
to_a
).
to
match_array
([
project2
,
project1
])
}
it
{
expect
(
child
.
all_projects
.
to_a
).
to
match_array
([
project2
])
}
end
context
'with recursive approach'
do
before
do
stub_feature_flags
(
recursive_approach_for_all_projects:
true
)
end
shared_examples
'all project examples'
do
include_examples
'all projects for a namespace'
context
'when namespace is a group'
do
let
(
:namespace
)
{
create
(
:group
)
}
let
_it_be
(
:namespace
)
{
create
(
:group
)
}
include_examples
'all projects for a namespace'
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
context
'with r
oute path wildcard
approach'
do
context
'with r
ecursive
approach'
do
before
do
stub_feature_flags
(
recursive_approach_for_all_projects:
fals
e
)
stub_feature_flags
(
recursive_approach_for_all_projects:
tru
e
)
end
include_examples
'all projects for a namespace'
context
'when namespace is a group'
do
let_it_be
(
:namespace
)
{
create
(
:group
)
}
include_examples
'all project examples'
end
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
include_examples
'all project examples'
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