Commit 1b19643c authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'leaky-constant-fix-4' into 'master'

Add stub for query recorder spec

See merge request gitlab-org/gitlab!31954
parents c66aa1f8 af88e668
...@@ -402,7 +402,6 @@ RSpec/LeakyConstantDeclaration: ...@@ -402,7 +402,6 @@ RSpec/LeakyConstantDeclaration:
- 'spec/services/metrics/dashboard/clone_dashboard_service_spec.rb' - 'spec/services/metrics/dashboard/clone_dashboard_service_spec.rb'
- 'spec/support/shared_contexts/spam_constants.rb' - 'spec/support/shared_contexts/spam_constants.rb'
- 'spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb' - 'spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb'
- 'spec/support_specs/helpers/active_record/query_recorder_spec.rb'
- 'spec/support_specs/matchers/exceed_query_limit_helpers_spec.rb' - 'spec/support_specs/matchers/exceed_query_limit_helpers_spec.rb'
- 'spec/uploaders/records_uploads_spec.rb' - 'spec/uploaders/records_uploads_spec.rb'
......
---
title: Add class stubs and fix leaky constant alert in query recorder spec
merge_request: 31954
author: Rajendra Kadam
type: fixed
...@@ -3,9 +3,13 @@ ...@@ -3,9 +3,13 @@
require 'spec_helper' require 'spec_helper'
describe ActiveRecord::QueryRecorder do describe ActiveRecord::QueryRecorder do
class TestQueries < ActiveRecord::Base before do
stub_const('TestQueries', Class.new(ActiveRecord::Base))
TestQueries.class_eval do
self.table_name = 'schema_migrations' self.table_name = 'schema_migrations'
end end
end
describe 'detecting the right number of calls and their origin' do describe 'detecting the right number of calls and their origin' do
it 'detects two separate queries' do it 'detects two separate queries' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment