diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2018-12-14 17:45:14 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-12-19 13:24:54 +0300 |
commit | 0ff27ce05960598e5a1c0a1115180db0feeb689a (patch) | |
tree | 2ae5e499696fee4f080ad62b7f50b302772dbfed /spec/lib/gitlab/current_settings_spec.rb | |
parent | cc5099c5ce79a7c062e2197b47f5f8a81bb48292 (diff) |
Method `create_from_defaults` will never give nil
Diffstat (limited to 'spec/lib/gitlab/current_settings_spec.rb')
-rw-r--r-- | spec/lib/gitlab/current_settings_spec.rb | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/spec/lib/gitlab/current_settings_spec.rb b/spec/lib/gitlab/current_settings_spec.rb index 06772fffce7..add8867d243 100644 --- a/spec/lib/gitlab/current_settings_spec.rb +++ b/spec/lib/gitlab/current_settings_spec.rb @@ -54,7 +54,7 @@ describe Gitlab::CurrentSettings do expect(ApplicationSetting).not_to receive(:current) end - it 'returns an in-memory ApplicationSetting object' do + it 'returns a FakeApplicationSettings object' do expect(described_class.current_application_settings).to be_a(Gitlab::FakeApplicationSettings) end @@ -157,17 +157,12 @@ describe Gitlab::CurrentSettings do end end - context 'when the application_settings table does not exists' do - it 'returns an in-memory ApplicationSetting object' do - expect(ApplicationSetting).to receive(:create_from_defaults).and_raise(ActiveRecord::StatementInvalid) - - expect(described_class.current_application_settings).to be_a(Gitlab::FakeApplicationSettings) - end - end - - context 'when the application_settings table is not fully migrated' do - it 'returns an in-memory ApplicationSetting object' do - expect(ApplicationSetting).to receive(:create_from_defaults).and_raise(ActiveRecord::UnknownAttributeError) + 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 |