Commit af88e668 authored by Rajendra Kadam's avatar Rajendra Kadam Committed by Peter Leitzen

Add stub for query recorder spec

parent 4ca162db
...@@ -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/content_type_whitelist_spec.rb' - 'spec/uploaders/content_type_whitelist_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