Commit 59c735bd authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'rs-gitlab-com-check' into 'master'

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.

See merge request !3682
parents cf306b17 2e13f6c3
require 'gitlab/git'
module Gitlab
def self.com?
Gitlab.config.gitlab.url == 'https://gitlab.com'
end
end
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
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