1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add a list of regexes assert_queries skips in the ActiveRecord test suite. [Rick]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4385 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Rick Olson 2006-05-31 20:47:03 +00:00
parent f9cd92f4ee
commit 05a17dc6b5
2 changed files with 7 additions and 1 deletions

View file

@ -1,5 +1,7 @@
*SVN* *SVN*
* Add a list of regexes assert_queries skips in the ActiveRecord test suite. [Rick]
* Fix the has_and_belongs_to_many #create doesn't populate the join for new records. Closes #3692 [josh@hasmanythrough.com] * Fix the has_and_belongs_to_many #create doesn't populate the join for new records. Closes #3692 [josh@hasmanythrough.com]
* Provide Association Extensions access to the instance that the association is being accessed from. * Provide Association Extensions access to the instance that the association is being accessed from.

View file

@ -56,9 +56,13 @@ end
ActiveRecord::Base.connection.class.class_eval do ActiveRecord::Base.connection.class.class_eval do
cattr_accessor :query_count cattr_accessor :query_count
# Array of regexes of queries that are not counted against query_count
@@ignore_list = [/^SELECT currval/]
alias_method :execute_without_query_counting, :execute alias_method :execute_without_query_counting, :execute
def execute_with_query_counting(sql, name = nil) def execute_with_query_counting(sql, name = nil)
self.query_count += 1 self.query_count += 1 unless @@ignore_list.any? { |r| sql =~ r }
execute_without_query_counting(sql, name) execute_without_query_counting(sql, name)
end end
end end