aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-12-02 11:16:07 -0800
committerXavier Noria <fxn@hashref.com>2011-12-02 11:16:26 -0800
commit0be5adaedf6565630bed04c6c651f3ff8d77c5b8 (patch)
tree93659d4d00d89bca44b2b3fbd6e49a757602f5ca /activerecord/test
parent36c014193ee5de84b1ac7ef50524c656e01b142d (diff)
downloadrails-0be5adaedf6565630bed04c6c651f3ff8d77c5b8.tar.gz
rails-0be5adaedf6565630bed04c6c651f3ff8d77c5b8.tar.bz2
rails-0be5adaedf6565630bed04c6c651f3ff8d77c5b8.zip
implements AR::Base(.|#)silence_auto_explain
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/explain_test.rb11
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