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
185a8b2d
Commit
185a8b2d
authored
Mar 12, 2020
by
Vladimir Shushlin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assert that pages API can't return subgroup
parent
9082e910
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
spec/models/namespace_spec.rb
spec/models/namespace_spec.rb
+16
-9
No files found.
spec/models/namespace_spec.rb
View file @
185a8b2d
...
...
@@ -201,17 +201,24 @@ describe Namespace do
expect
(
described_class
.
find_by_pages_host
(
host
)).
to
eq
(
namespace
)
end
it
'finds correct namespace even if there is sub-namespace with same path
'
do
group
=
create
(
:group
,
path:
'pages'
)
subgroup
=
create
(
:group
,
:nested
,
path:
'pages'
)
host
=
"pages.
#{
Settings
.
pages
.
host
.
upcase
}
"
context
'when there is non-top-level group with searched name
'
do
before
do
create
(
:group
,
:nested
,
path:
'pages'
)
end
# This is to ensure the method does the right thing
# becasue there is no way to be 100% sure which exact
# group will be returned by the database
expect
(
described_class
).
to
receive
(
:where
).
with
(
parent_id:
nil
).
and_call_original
it
'ignores this group'
do
host
=
"pages.
#{
Settings
.
pages
.
host
.
upcase
}
"
expect
(
described_class
.
find_by_pages_host
(
host
)).
to
be_nil
end
expect
(
described_class
.
find_by_pages_host
(
host
)).
to
eq
(
group
)
it
'finds right top level group'
do
group
=
create
(
:group
,
path:
'pages'
)
host
=
"pages.
#{
Settings
.
pages
.
host
.
upcase
}
"
expect
(
described_class
.
find_by_pages_host
(
host
)).
to
eq
(
group
)
end
end
it
"returns no result if the provided host is not subdomain of the Pages host"
do
...
...
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