summaryrefslogtreecommitdiff
path: root/spec/models/namespace_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-12 18:09:28 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-12 18:09:28 +0000
commitce8a0b90849ac5d1895e741c023432930f24d724 (patch)
treedbdc97de542cdbe18a2fc8b1a6b64ac0673ed3d3 /spec/models/namespace_spec.rb
parentdc889678d1de8c09310b2f8f9742bb6c78a6f1a4 (diff)
downloadgitlab-ce-ce8a0b90849ac5d1895e741c023432930f24d724.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/namespace_spec.rb')
-rw-r--r--spec/models/namespace_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb
index 276fbc2cb54..78b93b303f7 100644
--- a/spec/models/namespace_spec.rb
+++ b/spec/models/namespace_spec.rb
@@ -201,6 +201,26 @@ describe Namespace do
expect(described_class.find_by_pages_host(host)).to eq(namespace)
end
+ context 'when there is non-top-level group with searched name' do
+ before do
+ create(:group, :nested, path: 'pages')
+ end
+
+ it 'ignores this group' do
+ host = "pages.#{Settings.pages.host.upcase}"
+
+ expect(described_class.find_by_pages_host(host)).to be_nil
+ end
+
+ 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
create(:namespace, name: 'namespace.io')
host = "namespace.io"