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/monitor | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/lib/gitlab/monitor')
-rw-r--r-- | spec/lib/gitlab/monitor/demo_projects_spec.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/lib/gitlab/monitor/demo_projects_spec.rb b/spec/lib/gitlab/monitor/demo_projects_spec.rb new file mode 100644 index 00000000000..92024a3f9c1 --- /dev/null +++ b/spec/lib/gitlab/monitor/demo_projects_spec.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Gitlab::Monitor::DemoProjects do + describe '#primary_keys' do + subject { described_class.primary_keys } + + it 'fetches primary_keys when on gitlab.com' do + allow(Gitlab).to receive(:com?).and_return(true) + allow(Gitlab).to receive(:staging?).and_return(false) + + expect(subject).to eq(Gitlab::Monitor::DemoProjects::DOT_COM_IDS) + end + + it 'fetches primary_keys when on staging' do + allow(Gitlab).to receive(:com?).and_return(true) + allow(Gitlab).to receive(:staging?).and_return(true) + + expect(subject).to eq(Gitlab::Monitor::DemoProjects::STAGING_IDS) + end + + it 'fetches all keys when in the dev or test env' do + project = create(:project) + allow(Gitlab).to receive(:dev_or_test_env?).and_return(true) + + expect(subject).to eq([project.id]) + end + + it 'falls back on empty array' do + stub_config_setting(url: 'https://helloworld') + allow(Gitlab).to receive(:dev_or_test_env?).and_return(false) + + expect(subject).to eq([]) + end + end +end |