spec/support/matchers/perform_queries.rb in unread-0.7.0 vs spec/support/matchers/perform_queries.rb in unread-0.7.1
- old
+ new
@@ -1,6 +1,8 @@
RSpec::Matchers.define :perform_queries do |expected|
+ supports_block_expectations
+
match do |block|
query_count(&block) == expected
end
failure_message do |actual|
@@ -10,13 +12,8 @@
def query_count(&block)
@counter = ActiveRecord::QueryCounter.new
ActiveSupport::Notifications.subscribe('sql.active_record', @counter.to_proc)
yield
ActiveSupport::Notifications.unsubscribe(@counter.to_proc)
-
@counter.query_count
- end
-
- def supports_block_expectations?
- true
end
end