Sha256: 18654076b52f8f93f71ffc9e65f9aaa4f16b0ce9fa4328e2bf08e17b09628b36

Contents?: true

Size: 429 Bytes

Versions: 3

Compression:

Stored size: 429 Bytes

Contents

module Rspec
  module QueryLimit
    module ActiveRecord
      class QueryCounter

        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)
          @query_count += 1 unless %w(CACHE SCHEMA).include?(values[:name])
        end

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rspec-query-limit-0.1.2 lib/rspec/query_limit/query_counter.rb
rspec-query-limit-0.1.1 lib/rspec/query_limit/query_counter.rb
rspec-query-limit-0.1.0 lib/rspec/query_limit/query_counter.rb