debian-mirror-gitlab/spec/lib/gitlab/monitor/demo_projects_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
989 B
Ruby
Raw Permalink Normal View History

2020-06-23 00:09:42 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::Monitor::DemoProjects do
2020-06-23 00:09:42 +05:30
describe '#primary_keys' do
subject { described_class.primary_keys }
2023-05-27 22:25:52 +05:30
it 'fetches primary_keys when on SaaS', :saas do
2020-06-23 00:09:42 +05:30
allow(Gitlab).to receive(:staging?).and_return(false)
expect(subject).to eq(Gitlab::Monitor::DemoProjects::DOT_COM_IDS)
end
2023-05-27 22:25:52 +05:30
it 'fetches primary_keys when on staging', :saas do
2020-06-23 00:09:42 +05:30
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