diff options
author | Doug Stull <dstull@gitlab.com> | 2019-08-28 01:29:52 +0000 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2019-08-28 01:29:52 +0000 |
commit | fa674fa5e624a2bae7bc07ab28df0ede4edfef36 (patch) | |
tree | c4c864a0eb29b66d9ab6af98fdee8867ea5a6306 | |
parent | 6308c0ab0f7f4001bb644071495811120b5be5e3 (diff) | |
download | gitlab-ce-fa674fa5e624a2bae7bc07ab28df0ede4edfef36.tar.gz |
Rename dev, org, com helper
-rw-r--r-- | lib/gitlab.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab_spec.rb | 27 |
2 files changed, 28 insertions, 1 deletions
diff --git a/lib/gitlab.rb b/lib/gitlab.rb index d9d8dcf7900..e8b938e46b1 100644 --- a/lib/gitlab.rb +++ b/lib/gitlab.rb @@ -55,7 +55,7 @@ module Gitlab SUBDOMAIN_REGEX === Gitlab.config.gitlab.url end - def self.dev_env_or_com? + def self.dev_env_org_or_com? Rails.env.development? || org? || com? end diff --git a/spec/lib/gitlab_spec.rb b/spec/lib/gitlab_spec.rb index cbc5649fc09..1fc363460ae 100644 --- a/spec/lib/gitlab_spec.rb +++ b/spec/lib/gitlab_spec.rb @@ -98,6 +98,33 @@ describe Gitlab do end end + describe '.dev_env_org_or_com?' do + it 'is true when on .com' do + allow(described_class).to receive_messages(com?: true, org?: false) + + expect(described_class.dev_env_org_or_com?).to eq true + end + + it 'is true when org' do + allow(described_class).to receive_messages(com?: false, org?: true) + + expect(described_class.dev_env_org_or_com?).to eq true + end + + it 'is true when dev env' do + allow(described_class).to receive_messages(com?: false, org?: false) + allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('development')) + + expect(described_class.dev_env_org_or_com?).to eq true + end + + it 'is false when not dev, org or com' do + allow(described_class).to receive_messages(com?: false, org?: false) + + expect(described_class.dev_env_org_or_com?).to eq false + end + end + describe '.ee?' do before do described_class.instance_variable_set(:@is_ee, nil) |