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:
Diffstat (limited to 'spec/support_specs/helpers/active_record/query_recorder_spec.rb')
-rw-r--r--spec/support_specs/helpers/active_record/query_recorder_spec.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/spec/support_specs/helpers/active_record/query_recorder_spec.rb b/spec/support_specs/helpers/active_record/query_recorder_spec.rb
index f1af9ceffb9..d6c52b22449 100644
--- a/spec/support_specs/helpers/active_record/query_recorder_spec.rb
+++ b/spec/support_specs/helpers/active_record/query_recorder_spec.rb
@@ -78,12 +78,14 @@ RSpec.describe ActiveRecord::QueryRecorder do
end
describe 'detecting the right number of calls and their origin' do
- it 'detects two separate queries' do
- control = ActiveRecord::QueryRecorder.new query_recorder_debug: true do
+ let(:control) do
+ ActiveRecord::QueryRecorder.new query_recorder_debug: true do
2.times { TestQueries.count }
TestQueries.first
end
+ end
+ it 'detects two separate queries' do
# Check #find_query
expect(control.find_query(/.*/, 0).size)
.to eq(control.data.keys.size)
@@ -98,8 +100,8 @@ RSpec.describe ActiveRecord::QueryRecorder do
expect(control.log.size).to eq(3)
# Ensure memoization value match the raw value above
expect(control.count).to eq(control.log.size)
- # Ensure we have only two sources of queries
- expect(control.data.keys.size).to eq(1)
+ # Ensure we have two sources of queries
+ expect(control.data.keys.size).to eq(2)
end
end
end