instance method assert_no_queries_match

Ruby on Rails 8.0.4

Since v7.2.3

Available in: v7.2.3 v8.0.4 v8.1.2

Signature

assert_no_queries_match(match, include_schema: false, &block)

Asserts that no SQL queries matching the pattern are executed in the given block.

assert_no_queries_match(/SELECT/i) { post.comments }

If the :include_schema option is provided, any queries (including schema related) that match the matcher are counted.

assert_no_queries_match(/FROM pg_attribute/i, include_schema: true) { Post.columns }

Parameters

match req
include_schema key = false
block block
Source
# File activerecord/lib/active_record/testing/query_assertions.rb, line 87
      def assert_no_queries_match(match, include_schema: false, &block)
        assert_queries_match(match, count: 0, include_schema: include_schema, &block)
      end

Defined in activerecord/lib/active_record/testing/query_assertions.rb line 87 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Assertions::QueryAssertions

Type at least 2 characters to search.

↑↓ navigate · open · esc close