instance method
assert_no_queries_match
Ruby on Rails edge
Since v7.2.4Signature
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 }
```
: [R] (String | Regexp, ?include_schema: bool) { () -> R } -> R
Parameters
-
matchreq -
include_schemakey = false -
blockblock
Source
# File activerecord/lib/active_record/testing/query_assertions.rb, line 113
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 113
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Assertions::QueryAssertions