class RSpec::Matchers::BuiltIn::YieldControl
@api private Provides the implementation for `yield_control`. Not intended to be instantiated directly.
Public Instance Methods
does_not_match?(block)
click to toggle source
@private
# File lib/rspec/matchers/built_in/yield.rb, line 111 def does_not_match?(block) !matches?(block) && @probe.has_block? end
failure_message()
click to toggle source
@api private @return [String]
# File lib/rspec/matchers/built_in/yield.rb, line 117 def failure_message 'expected given block to yield control' + failure_reason end
failure_message_when_negated()
click to toggle source
@api private @return [String]
# File lib/rspec/matchers/built_in/yield.rb, line 123 def failure_message_when_negated 'expected given block not to yield control' + failure_reason end
matches?(block)
click to toggle source
@private
# File lib/rspec/matchers/built_in/yield.rb, line 104 def matches?(block) @probe = YieldProbe.probe(block) return false unless @probe.has_block? expected_count_matches?(@probe.num_yields) end
supports_block_expectations?()
click to toggle source
@private
# File lib/rspec/matchers/built_in/yield.rb, line 128 def supports_block_expectations? true end
Private Instance Methods
failure_reason()
click to toggle source
# File lib/rspec/matchers/built_in/yield.rb, line 134 def failure_reason return ' but was not a block' unless @probe.has_block? return "#{count_expectation_description} but did not yield" if @probe.num_yields == 0 count_failure_reason('yielded') end