Class: RSpec::Matchers::BuiltIn::YieldControl

Inherits:
BaseMatcher
  • Object
show all
Defined in:
lib/rspec/matchers/built_in/yield.rb

Instance Attribute Summary

Attributes inherited from BaseMatcher

#actual, #expected, #rescued_exception

Instance Method Summary collapse

Methods inherited from BaseMatcher

#==, #description, #diffable?, #initialize, #match_unless_raises

Methods included from Pretty

#_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #underscore

Constructor Details

This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher

Instance Method Details

#failure_message_for_shouldObject



73
74
75
# File 'lib/rspec/matchers/built_in/yield.rb', line 73

def failure_message_for_should
  "expected given block to yield control"
end

#failure_message_for_should_notObject



77
78
79
# File 'lib/rspec/matchers/built_in/yield.rb', line 77

def failure_message_for_should_not
  "expected given block not to yield control"
end

#matches?(block) ⇒ Boolean

Returns:

  • (Boolean)


68
69
70
71
# File 'lib/rspec/matchers/built_in/yield.rb', line 68

def matches?(block)
  probe = YieldProbe.probe(block)
  probe.yielded_once?(:yield_control)
end