summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-06-29 21:47:49 +0000
committerRobert Speicher <robert@gitlab.com>2016-06-29 21:47:49 +0000
commit65187efa5c7202e8b6429edfd17ad844cd584a32 (patch)
tree931bacee312e60e24a830c1af3d31eed13f75612
parenteae5f8aa57d61ce17f6b4885b8da463d1d33e971 (diff)
parentd3d0e3dd5de9d00cbb6c8f2ec3c82bfdbb146ff3 (diff)
downloadgitlab-ce-65187efa5c7202e8b6429edfd17ad844cd584a32.tar.gz
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
-rw-r--r--lib/gitlab.rb7
-rw-r--r--spec/lib/gitlab_spec.rb6
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/gitlab.rb b/lib/gitlab.rb
index 37f4c34054f..c3064163e07 100644
--- a/lib/gitlab.rb
+++ b/lib/gitlab.rb
@@ -2,6 +2,11 @@ require_dependency 'gitlab/git'
module Gitlab
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
diff --git a/spec/lib/gitlab_spec.rb b/spec/lib/gitlab_spec.rb
index c59dfea5c55..c4c107c9eea 100644
--- a/spec/lib/gitlab_spec.rb
+++ b/spec/lib/gitlab_spec.rb
@@ -8,6 +8,12 @@ describe Gitlab, lib: true do
expect(described_class.com?).to eq true
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
stub_config_setting(url: 'http://example.com')