diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 21:38:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 21:38:24 +0300 |
commit | 983a0bba5d2a042c4a3bbb22432ec192c7501d82 (patch) | |
tree | b153cd387c14ba23bd5a07514c7c01fddf6a78a0 /spec/lib/gitlab/current_settings_spec.rb | |
parent | a2bddee2cdb38673df0e004d5b32d9f77797de64 (diff) |
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'spec/lib/gitlab/current_settings_spec.rb')
-rw-r--r-- | spec/lib/gitlab/current_settings_spec.rb | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/spec/lib/gitlab/current_settings_spec.rb b/spec/lib/gitlab/current_settings_spec.rb index adbd7eabd18..bfd9980ee9c 100644 --- a/spec/lib/gitlab/current_settings_spec.rb +++ b/spec/lib/gitlab/current_settings_spec.rb @@ -49,20 +49,16 @@ describe Gitlab::CurrentSettings do end end - context 'with DB unavailable' do - context 'and settings in cache' do - include_context 'with settings in cache' - - it 'fetches the settings from cache without issuing any query' do - expect(ActiveRecord::QueryRecorder.new { described_class.current_application_settings }.count).to eq(0) - end + context 'in a Rake task with DB unavailable' do + before do + allow(Gitlab::Runtime).to receive(:rake?).and_return(true) + # For some reason, `allow(described_class).to receive(:connect_to_db?).and_return(false)` causes issues + # during the initialization phase of the test suite, so instead let's mock the internals of it + allow(ActiveRecord::Base.connection).to receive(:active?).and_return(false) end context 'and no settings in cache' do before do - # For some reason, `allow(described_class).to receive(:connect_to_db?).and_return(false)` causes issues - # during the initialization phase of the test suite, so instead let's mock the internals of it - allow(ActiveRecord::Base.connection).to receive(:active?).and_return(false) expect(ApplicationSetting).not_to receive(:current) end @@ -185,17 +181,6 @@ describe Gitlab::CurrentSettings do expect(described_class.current_application_settings).to eq(:current_settings) end end - - context 'when the application_settings table does not exist' do - it 'returns a FakeApplicationSettings object' do - expect(Gitlab::Database) - .to receive(:cached_table_exists?) - .with('application_settings') - .and_return(false) - - expect(described_class.current_application_settings).to be_a(Gitlab::FakeApplicationSettings) - end - end end end end |