diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/lib/gitlab_spec.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/lib/gitlab_spec.rb')
-rw-r--r-- | spec/lib/gitlab_spec.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/lib/gitlab_spec.rb b/spec/lib/gitlab_spec.rb index 9362ff72fbc..84d072a50ec 100644 --- a/spec/lib/gitlab_spec.rb +++ b/spec/lib/gitlab_spec.rb @@ -96,6 +96,28 @@ describe Gitlab do end end + describe '.staging?' do + subject { described_class.staging? } + + it 'is false when on GitLab.com' do + stub_config_setting(url: 'https://gitlab.com') + + expect(subject).to eq false + end + + it 'is true when on staging' do + stub_config_setting(url: 'https://staging.gitlab.com') + + expect(subject).to eq true + end + + it 'is false when not on staging' do + stub_config_setting(url: 'https://example.gitlab.com') + + expect(subject).to eq false + end + end + describe '.canary?' do it 'is true when CANARY env var is set to true' do stub_env('CANARY', '1') @@ -186,6 +208,26 @@ describe Gitlab do end end + describe '.dev_or_test_env?' do + subject { described_class.dev_or_test_env? } + + it 'is true when test env' do + expect(subject).to eq true + end + + it 'is true when dev env' do + allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('development')) + + expect(subject).to eq true + end + + it 'is false when env is not dev or test' do + allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('production')) + + expect(subject).to eq false + end + end + describe '.ee?' do before do stub_env('FOSS_ONLY', nil) # Make sure the ENV is clean |