Class: Crspec::Matchers::YieldControlMatcher
Instance Attribute Summary
Attributes inherited from BaseMatcher
#actual, #expected
Instance Method Summary
collapse
Methods inherited from BaseMatcher
#and, #initialize, #or
Instance Method Details
#failure_message ⇒ Object
652
653
654
|
# File 'lib/crspec/matchers.rb', line 652
def failure_message
"Expected block to yield control, but it did not"
end
|
#failure_message_when_negated ⇒ Object
656
657
658
|
# File 'lib/crspec/matchers.rb', line 656
def failure_message_when_negated
"Expected block not to yield control, but it yielded #{@yielded} time(s)"
end
|
#matches?(block) ⇒ Boolean
645
646
647
648
649
650
|
# File 'lib/crspec/matchers.rb', line 645
def matches?(block)
@yielded = 0
probe = ->(*) { @yielded += 1 }
block.call(probe)
@yielded.positive?
end
|