From 7dd1a57413b86d3a6745bcebbee29bf37678cfb7 Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Wed, 7 Feb 2018 14:38:58 -0300 Subject: [PATCH] Exclude expect to change expectation block queries in exceed_query_limit matcher --- lib/rspec/dunlop/matchers/exceed_query_limit.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/rspec/dunlop/matchers/exceed_query_limit.rb b/lib/rspec/dunlop/matchers/exceed_query_limit.rb index 4ed97cd..fc23ca2 100644 --- a/lib/rspec/dunlop/matchers/exceed_query_limit.rb +++ b/lib/rspec/dunlop/matchers/exceed_query_limit.rb @@ -17,6 +17,8 @@ module ActiveRecord count_query = true count_query = false if %w[ CACHE SCHEMA SAVEPOINT ].include?(values[:name]) or values[:sql]['SAVEPOINT'] count_query = false if %w[ BEGIN COMMIT ].include?(values[:sql]) + count_query = false if values[:sql].to_s.end_with?('subquery_for_count') # expect change blocks + count_query = false if values[:sql].to_s['1 AS one'] # expect change blocks if count_query @query_count += 1 @performed_queries << values[:sql]