Commit 594d42a7 authored by Nailia Iskhakova's avatar Nailia Iskhakova Committed by James Lopez

Support hyphens in GitLab subdomain regex

To allow Staging Ref env be
configred as gitlab.com instance
Signed-off-by: default avatarNailia Iskhakova <niskhakova@gitlab.com>
parent b5484949
...@@ -18,7 +18,7 @@ module Gitlab ...@@ -18,7 +18,7 @@ module Gitlab
end end
def self.subdomain_regex def self.subdomain_regex
%r{\Ahttps://[a-z0-9]+\.gitlab\.com\z}.freeze %r{\Ahttps://[a-z0-9-]+\.gitlab\.com\z}.freeze
end end
def self.dev_url def self.dev_url
......
...@@ -99,6 +99,13 @@ RSpec.describe Gitlab do ...@@ -99,6 +99,13 @@ RSpec.describe Gitlab do
expect(described_class.com?).to eq true expect(described_class.com?).to eq true
end end
it 'is true when on other gitlab subdomain with hyphen' do
url_with_subdomain = Gitlab::Saas.com_url.gsub('https://', 'https://test-example.')
stub_config_setting(url: url_with_subdomain)
expect(described_class.com?).to eq true
end
it 'is false when not on GitLab.com' do it 'is false when not on GitLab.com' do
stub_config_setting(url: 'http://example.com') stub_config_setting(url: 'http://example.com')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment