Skip to content
Browse files

speeding up ignored sql testing

  • Loading branch information...
1 parent 76c29a6 commit 38a8f7f8ba22ee03bf5320921775e76c071d460e @tenderlove tenderlove committed Dec 7, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 activerecord/test/cases/helper.rb
View
5 activerecord/test/cases/helper.rb
@@ -65,6 +65,9 @@ class SQLCounter
# 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 = []
@@ -74,7 +77,7 @@ def call(name, start, finish, message_id, values)
# 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.any? { |r| sql =~ r }
+ self.class.log << sql unless self.class.ignored_sql_regexp =~ sql
end
end
end

0 comments on commit 38a8f7f

Please sign in to comment.
Something went wrong with that request. Please try again.