Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarka Kadlecová <jarka@gitlab.com>2018-06-05 12:29:33 +0300
committerJarka Kadlecová <jarka@gitlab.com>2018-06-14 09:39:43 +0300
commitfa36101a7fc8679d98198942f15dd6285673594d (patch)
tree75d233d7910354ef47511de29929800fb35cb4ad /spec/lib/gitlab/database_spec.rb
parent760b12dc6b3a927c918855e2ee85a1c0e6bddb73 (diff)
Use data_source_exists? instead of table_exists?
Use data_source_exists? where possible instead of table_exists? in order to be Rails5 compatible
Diffstat (limited to 'spec/lib/gitlab/database_spec.rb')
-rw-r--r--spec/lib/gitlab/database_spec.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/spec/lib/gitlab/database_spec.rb b/spec/lib/gitlab/database_spec.rb
index 8ac36ae8bab..8bb246aa4bd 100644
--- a/spec/lib/gitlab/database_spec.rb
+++ b/spec/lib/gitlab/database_spec.rb
@@ -314,8 +314,13 @@ describe Gitlab::Database do
describe '.cached_table_exists?' do
it 'only retrieves data once per table' do
- expect(ActiveRecord::Base.connection).to receive(:table_exists?).with(:projects).once.and_call_original
- expect(ActiveRecord::Base.connection).to receive(:table_exists?).with(:bogus_table_name).once.and_call_original
+ if Gitlab.rails5?
+ expect(ActiveRecord::Base.connection).to receive(:data_source_exists?).with(:projects).once.and_call_original
+ expect(ActiveRecord::Base.connection).to receive(:data_source_exists?).with(:bogus_table_name).once.and_call_original
+ else
+ expect(ActiveRecord::Base.connection).to receive(:table_exists?).with(:projects).once.and_call_original
+ expect(ActiveRecord::Base.connection).to receive(:table_exists?).with(:bogus_table_name).once.and_call_original
+ end
2.times do
expect(described_class.cached_table_exists?(:projects)).to be_truthy