Add Gitlab.com? method

To be used as a feature flag for GitLab.com-only features, such as
welcome emails.

We will be careful to only use this to disable features or functionality
that do not make sense for any installations that aren't GitLab.com. We
will not use this to restrict features from other installations or keep
them "exclusive" to GitLab.com.
This commit is contained in:
Robert Speicher 2016-04-12 14:39:08 -04:00
parent 2c9894d457
commit 2e13f6c326
2 changed files with 20 additions and 0 deletions

View file

@ -1,4 +1,7 @@
require 'gitlab/git' require 'gitlab/git'
module Gitlab module Gitlab
def self.com?
Gitlab.config.gitlab.url == 'https://gitlab.com'
end
end end

17
spec/lib/gitlab_spec.rb Normal file
View file

@ -0,0 +1,17 @@
require 'rails_helper'
describe Gitlab, lib: true do
describe '.com?' do
it 'is true when on GitLab.com' do
stub_config_setting(url: 'https://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')
expect(described_class.com?).to eq false
end
end
end