class RSpec::Matchers::BuiltIn::YieldWithNoArgs
Public Instance Methods
failure_message_for_should()
click to toggle source
# File lib/rspec/matchers/built_in/yield.rb, line 164 def failure_message_for_should "expected given block to yield with no arguments, but #{failure_reason}" end
failure_message_for_should_not()
click to toggle source
# File lib/rspec/matchers/built_in/yield.rb, line 168 def failure_message_for_should_not "expected given block not to yield with no arguments, but did" end
matches?(block)
click to toggle source
# File lib/rspec/matchers/built_in/yield.rb, line 159 def matches?(block) @probe = YieldProbe.probe(block) @probe.yielded_once?(:yield_with_no_args) && @probe.single_yield_args.empty? end
Private Instance Methods
failure_reason()
click to toggle source
# File lib/rspec/matchers/built_in/yield.rb, line 174 def failure_reason if @probe.num_yields.zero? "did not yield" else "yielded with arguments: #{@probe.single_yield_args.inspect}" end end