@api private Provides the implementation for `yield_with_no_args`. Not intended to be instantiated directly.
@private
# File lib/rspec/matchers/built_in/yield.rb, line 208 def does_not_match?(block) !matches?(block) && @probe.has_block? end
@private
# File lib/rspec/matchers/built_in/yield.rb, line 213 def failure_message "expected given block to yield with no arguments, but #{positive_failure_reason}" end
@private
# File lib/rspec/matchers/built_in/yield.rb, line 218 def failure_message_when_negated "expected given block not to yield with no arguments, but #{negative_failure_reason}" end
@private
# File lib/rspec/matchers/built_in/yield.rb, line 201 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
@private
# File lib/rspec/matchers/built_in/yield.rb, line 223 def supports_block_expectations? true end
# File lib/rspec/matchers/built_in/yield.rb, line 235 def negative_failure_reason return "was not a block" unless @probe.has_block? "did" end
# File lib/rspec/matchers/built_in/yield.rb, line 229 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: #{@probe.single_yield_args.inspect}" end