to not_make_database_queries vs to_not make_database_queries
entrity opened this issue · comments
It looks like this could benefit from adding support for .to not_make_database_queries
, which is different from .to_not make_database_queries
:
If the user wants to chain multiple negative matchers together with .and
, then .to_not
is not an option (except for the first negative matcher), and .and_not
doesn't exist. (Neither will .and_not
exist in the future because of ambiguity.)
# Bad example: `and_not` doesn't exist
expect {
# ...
}.to_not raise_exception
.and_not make_db_queries(matching: /my-regex/)
# Proposed solution
expect {
# ...
}.to_not raise_exception
.and not_make_db_queries(matching: /my-regex/)
Nvm. Users can define their own negative matcher.
RSpec::Matchers.define_negated_matcher :not_make_database_queries, :make_database_queries