module Rspec::QueryLimit

Constants

VERSION

Public Instance Methods

failure_text() click to toggle source
# File lib/rspec/query_limit/matchers.rb, line 39
def failure_text
  "Expected to run exactly #{expected} queries, got #{@counter.query_count}"
end
failure_text_negated() click to toggle source
# File lib/rspec/query_limit/matchers.rb, line 43
def failure_text_negated
  "Expected to run other than #{expected} queries, got #{@counter.query_count}"
end
query_count(&block) click to toggle source
# File lib/rspec/query_limit/matchers.rb, line 29
def query_count(&block)
  @counter = ActiveRecord::QueryCounter.new
  ActiveSupport::Notifications.subscribed(@counter.to_proc, 'sql.active_record', &block)
  @counter.query_count
end
supports_block_expectations?() click to toggle source
# File lib/rspec/query_limit/matchers.rb, line 35
def supports_block_expectations?
  true
end