Commit 65187efa authored by Robert Speicher's avatar Robert Speicher
Browse files

Merge branch 'rs-gitalb-com-staging' into 'master'

Update `Gitlab.com?` to support staging

Ref: https://gitlab.com/gitlab-com/operations/issues/324#note_12428337

See merge request !4637
...@@ -2,6 +2,11 @@ ...@@ -2,6 +2,11 @@
module Gitlab module Gitlab
def self.com? def self.com?
Gitlab.config.gitlab.url == 'https://gitlab.com' # Check `staging?` as well to keep parity with gitlab.com
Gitlab.config.gitlab.url == 'https://gitlab.com' || staging?
end
def self.staging?
Gitlab.config.gitlab.url == 'https://staging.gitlab.com'
end end
end end
...@@ -8,6 +8,12 @@ ...@@ -8,6 +8,12 @@
expect(described_class.com?).to eq true expect(described_class.com?).to eq true
end end
it 'is true when on staging' do
stub_config_setting(url: 'https://staging.gitlab.com')
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