aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-12-07 17:42:05 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-12-07 17:42:05 -0800
commita505b1377422a1821798d060301c50abea6afbd4 (patch)
treea2893375dec9a88056eda7343cc2d6bb91209324 /activerecord
parent38a8f7f8ba22ee03bf5320921775e76c071d460e (diff)
downloadrails-a505b1377422a1821798d060301c50abea6afbd4.tar.gz
rails-a505b1377422a1821798d060301c50abea6afbd4.tar.bz2
rails-a505b1377422a1821798d060301c50abea6afbd4.zip
moving ignored regexp to the instance
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/helper.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb
index c62a172a1c..b750a03fba 100644
--- a/activerecord/test/cases/helper.rb
+++ b/activerecord/test/cases/helper.rb
@@ -65,20 +65,22 @@ module ActiveRecord
# ignored SQL. This ignored SQL is for Oracle.
ignored_sql.concat [/^select .*nextval/i, /^SAVEPOINT/, /^ROLLBACK TO/, /^\s*select .* from all_triggers/im]
- cattr_accessor :ignored_sql_regexp
- self.ignored_sql_regexp = Regexp.union ignored_sql
-
cattr_accessor :log
self.log = []
+ attr_reader :ignore
+
+ def initialize(ignore = Regexp.union(self.class.ignored_sql))
+ @ignore = ignore
+ end
+
def call(name, start, finish, message_id, values)
sql = values[:sql]
# FIXME: this seems bad. we should probably have a better way to indicate
# the query was cached
- unless 'CACHE' == values[:name]
- self.class.log << sql unless self.class.ignored_sql_regexp =~ sql
- end
+ return if 'CACHE' == values[:name] || ignore =~ sql
+ self.class.log << sql
end
end