diff options
Diffstat (limited to 'spec/lib/gitlab/database_spec.rb')
-rw-r--r-- | spec/lib/gitlab/database_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/lib/gitlab/database_spec.rb b/spec/lib/gitlab/database_spec.rb index 3db8900ed8e..4a0eab3ea27 100644 --- a/spec/lib/gitlab/database_spec.rb +++ b/spec/lib/gitlab/database_spec.rb @@ -396,6 +396,20 @@ describe Gitlab::Database do end end + describe '.exists?' do + it 'returns true if `ActiveRecord::Base.connection` succeeds' do + expect(ActiveRecord::Base).to receive(:connection) + + expect(described_class.exists?).to be(true) + end + + it 'returns false if `ActiveRecord::Base.connection` fails' do + expect(ActiveRecord::Base).to receive(:connection) { raise ActiveRecord::NoDatabaseError, 'broken' } + + expect(described_class.exists?).to be(false) + end + end + describe '#true_value' do it 'returns correct value' do expect(described_class.true_value).to eq "'t'" |