Permalink
Browse files

Add EnhancedQueryAnalyzer.slow_query_time = <time> or nil to log all …

…queries
  • Loading branch information...
1 parent 1637d8c commit 6c653e25e40284663f1bbf59f751be7881774a04 @smtlaissezfaire committed Dec 28, 2009
Showing with 15 additions and 0 deletions.
  1. +6 −0 lib/enhanced_query_analyzer/logging.rb
  2. +9 −0 spec/enhanced_query_analyzer/query_analyzer_spec.rb
@@ -11,6 +11,12 @@ def logging
@logging
end
+ def slow_query_time
+ @slow_query_time ||= nil
+ end
+
+ attr_writer :slow_query_time
+
def reset!
@logging = nil
@explain_logging = nil
@@ -33,4 +33,13 @@
EnhancedQueryAnalyzer.reset!
EnhancedQueryAnalyzer.explain_logging.should be_false
end
+
+ it "should have a nil slow_query_time" do
+ EnhancedQueryAnalyzer.slow_query_time.should be_nil
+ end
+
+ it "should be able to set the slow_query_time" do
+ EnhancedQueryAnalyzer.slow_query_time = 10
+ EnhancedQueryAnalyzer.slow_query_time.should == 10
+ end
end

0 comments on commit 6c653e2

Please sign in to comment.