Update Gitlab.com? to support staging

This commit is contained in:
Robert Speicher
2016-06-13 17:43:29 -04:00
parent 298e4ece30
commit d3d0e3dd5d
2 changed files with 12 additions and 1 deletions

View File

@ -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

View File

@ -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')