blob: 3b15d804d7c450216012f1735fc75d9be87fd6d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
|