Class: RSpec::Matchers::BuiltIn::YieldWithArgs
- Inherits:
-
Object
- Object
- RSpec::Matchers::BuiltIn::YieldWithArgs
- Defined in:
- lib/rspec/matchers/built_in/yield.rb
Instance Method Summary (collapse)
- - (Object) description
- - (Object) failure_message_for_should
- - (Object) failure_message_for_should_not
-
- (YieldWithArgs) initialize(*args)
constructor
A new instance of YieldWithArgs.
- - (Boolean) matches?(block) (also: #==)
Constructor Details
- (YieldWithArgs) initialize(*args)
A new instance of YieldWithArgs
109 110 111 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 109 def initialize(*args) @expected = args end |
Instance Method Details
- (Object) description
128 129 130 131 132 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 128 def description desc = "yield with args" desc << "(" + @expected.map { |e| e.inspect }.join(", ") + ")" unless @expected.empty? desc end |
- (Object) failure_message_for_should
120 121 122 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 120 def "expected given block to yield with arguments, but #{positive_failure_reason}" end |
- (Object) failure_message_for_should_not
124 125 126 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 124 def "expected given block not to yield with arguments, but #{negative_failure_reason}" end |
- (Boolean) matches?(block) Also known as: ==
113 114 115 116 117 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 113 def matches?(block) @probe = YieldProbe.probe(block) @actual = @probe.single_yield_args @probe.yielded_once?(:yield_with_args) && args_match? end |