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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-13 18:09:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-13 18:09:21 +0300
commitc36152ff8c41fad2f413f253eb7ac5c927e47c56 (patch)
treebbf300da207de3e8bbf272d44111ceedb18f5833 /spec/support_specs
parent286fe61013674fe2d245ffc8d2233baf09923e70 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support_specs')
-rw-r--r--spec/support_specs/matchers/exceed_query_limit_helpers_spec.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/support_specs/matchers/exceed_query_limit_helpers_spec.rb b/spec/support_specs/matchers/exceed_query_limit_helpers_spec.rb
new file mode 100644
index 00000000000..3b15d804d7c
--- /dev/null
+++ b/spec/support_specs/matchers/exceed_query_limit_helpers_spec.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe ExceedQueryLimitHelpers do
+ class TestQueries < ActiveRecord::Base
+ self.table_name = 'schema_migrations'
+ end
+
+ class TestMatcher
+ include ExceedQueryLimitHelpers
+
+ def expected
+ ActiveRecord::QueryRecorder.new do
+ 2.times { TestQueries.count }
+ end
+ end
+ end
+
+ it 'does not contain marginalia annotations' do
+ test_matcher = TestMatcher.new
+ test_matcher.verify_count do
+ 2.times { TestQueries.count }
+ TestQueries.first
+ end
+
+ aggregate_failures do
+ expect(test_matcher.log_message)
+ .to match(%r{ORDER BY.*#{TestQueries.table_name}.*LIMIT 1})
+ expect(test_matcher.log_message)
+ .not_to match(%r{\/\*.*correlation_id.*\*\/})
+ end
+ end
+end