diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-03-16 15:36:28 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2018-03-19 20:36:37 +0300 |
commit | 4cfe7682bdf50f41404d130a0e3e63389ed85809 (patch) | |
tree | 99ba6ebd87d7f2a3900012fc9903c6b5de225694 /spec/lib | |
parent | fb4eb55540a91ff86972909d8b1db95b9ad105e1 (diff) |
Merge branch 'sh-cache-column-exists' into 'master'
Cache column_exists? for application settings
See merge request gitlab-org/gitlab-ce!17780
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/database_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/lib/gitlab/database_spec.rb b/spec/lib/gitlab/database_spec.rb index b2f13fae73f..689bbbfaa8d 100644 --- a/spec/lib/gitlab/database_spec.rb +++ b/spec/lib/gitlab/database_spec.rb @@ -287,6 +287,17 @@ describe Gitlab::Database do end end + describe '.cached_column_exists?' do + it 'only retrieves data once' do + expect(ActiveRecord::Base.connection).to receive(:columns).once.and_call_original + + 2.times do + expect(described_class.cached_column_exists?(:projects, :id)).to be_truthy + expect(described_class.cached_column_exists?(:projects, :bogus_column)).to be_falsey + end + end + end + describe '#true_value' do it 'returns correct value for PostgreSQL' do expect(described_class).to receive(:postgresql?).and_return(true) |