class RSpec::Matchers::BuiltIn::YieldWithNoArgs
Not intended to be instantiated directly.
Provides the implementation for ‘yield_with_no_args`.
@api private
def does_not_match?(block)
- Private: -
def does_not_match?(block) !matches?(block) && @probe.has_block? end
def failure_message
- Private: -
def failure_message "expected given block to yield with no arguments, but #{positive_failure_reason}" end
def failure_message_when_negated
- Private: -
def failure_message_when_negated "expected given block not to yield with no arguments, but #{negative_failure_reason}" end
def matches?(block)
- Private: -
def matches?(block) @probe = YieldProbe.probe(block) return false unless @probe.has_block? @probe.yielded_once?(:yield_with_no_args) && @probe.single_yield_args.empty? end
def negative_failure_reason
def negative_failure_reason return 'was not a block' unless @probe.has_block? 'did' end
def positive_failure_reason
def positive_failure_reason return 'was not a block' unless @probe.has_block? return 'did not yield' if @probe.num_yields.zero? "yielded with arguments: #{description_of @probe.single_yield_args}" end
def supports_block_expectations?
- Private: -
def supports_block_expectations? true end
def supports_value_expectations?
- Private: -
def supports_value_expectations? false end