Updated

spec/support / query_counter.rb

A
19 lines of codes
3 methods
3.2 complexity/method
1 churn
9.52 complexity
0 duplications
# From: https://gist.github.com/rsutphin/af06c9e3dadf658d2293 # adapted from http://stackoverflow.com/a/13423584/153896 module ActiveRecord class QueryCounter
  1. ActiveRecord::QueryCounter has no descriptive comment
attr_reader :query_count def initialize @query_count = 0 end def to_proc lambda(&method(:callback)) end def callback(name, start, finish, message_id, values)
  1. ActiveRecord::QueryCounter#callback has 5 parameters
  2. ActiveRecord::QueryCounter#callback has unused parameter 'finish'
  3. ActiveRecord::QueryCounter#callback has unused parameter 'message_id'
  4. ActiveRecord::QueryCounter#callback has unused parameter 'name'
  5. ActiveRecord::QueryCounter#callback has unused parameter 'start'
@query_count += 1 unless %w(CACHE SCHEMA).include?(values[:name]) end end end