diff options
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 |