diff options
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/explain_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/explain_test.rb b/activerecord/test/cases/explain_test.rb index d3eb9c2cb2..ff460b44eb 100644 --- a/activerecord/test/cases/explain_test.rb +++ b/activerecord/test/cases/explain_test.rb @@ -80,6 +80,17 @@ if ActiveRecord::Base.connection.supports_explain? assert_equal expected, base.exec_explain(sqls, binds) end + def test_silence_auto_explain + base.expects(:collecting_sqls_for_explain).never + base.logger.expects(:warn).never + + [base, cars(:honda)].each do |target| + target.silence_auto_explain do + with_threshold(0) { Car.all } + end + end + end + def with_threshold(threshold) current_threshold = base.auto_explain_threshold_in_seconds base.auto_explain_threshold_in_seconds = threshold |