diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-03-28 15:27:37 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-03-28 15:27:37 -0700 |
commit | e1a5007207b8bd9e91711428acc3104f4c8e8fb8 (patch) | |
tree | 4e2b71fe8d81e991046587fcd7fd69a3675175b0 /activerecord/test | |
parent | fb215110401c70cfc7013c6e2ad5753fa4e374e9 (diff) | |
download | rails-e1a5007207b8bd9e91711428acc3104f4c8e8fb8.tar.gz rails-e1a5007207b8bd9e91711428acc3104f4c8e8fb8.tar.bz2 rails-e1a5007207b8bd9e91711428acc3104f4c8e8fb8.zip |
sql logger ignores schema statements
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/log_subscriber_test.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/activerecord/test/cases/log_subscriber_test.rb b/activerecord/test/cases/log_subscriber_test.rb index cbaaca764b..8ebde933b4 100644 --- a/activerecord/test/cases/log_subscriber_test.rb +++ b/activerecord/test/cases/log_subscriber_test.rb @@ -22,6 +22,33 @@ class LogSubscriberTest < ActiveRecord::TestCase ActiveRecord::Base.logger = logger end + def test_schema_statements_are_ignored + event = Struct.new(:duration, :payload) + + logger = Class.new(ActiveRecord::LogSubscriber) { + attr_accessor :debugs + + def initialize + @debugs = [] + super + end + + def debug message + @debugs << message + end + }.new + assert_equal 0, logger.debugs.length + + logger.sql(event.new(0, { :sql => 'hi mom!' })) + assert_equal 1, logger.debugs.length + + logger.sql(event.new(0, { :sql => 'hi mom!', :name => 'foo' })) + assert_equal 2, logger.debugs.length + + logger.sql(event.new(0, { :sql => 'hi mom!', :name => 'SCHEMA' })) + assert_equal 2, logger.debugs.length + end + def test_basic_query_logging Developer.all wait |