Class: RSpec::Matchers::BuiltIn::YieldSuccessiveArgs
- Inherits:
-
Object
- Object
- RSpec::Matchers::BuiltIn::YieldSuccessiveArgs
- Includes:
- MatchAliases
- 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
-
- (YieldSuccessiveArgs) initialize(*args)
constructor
A new instance of YieldSuccessiveArgs.
- - (Boolean) matches?(block)
Methods included from MatchAliases
Constructor Details
- (YieldSuccessiveArgs) initialize(*args)
A new instance of YieldSuccessiveArgs
272 273 274 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 272 def initialize(*args) @expected = args end |
Instance Method Details
- (Object) description
294 295 296 297 298 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 294 def description desc = "yield successive args" desc << "(" + @expected.map { |e| e.inspect }.join(", ") + ")" desc end |
- (Object) failure_message_for_should
282 283 284 285 286 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 282 def "expected given block to yield successively with arguments, but yielded with unexpected arguments" + "\nexpected: #{@expected.inspect}" + "\n got: #{@actual.inspect} (compared using === and ==)" end |
- (Object) failure_message_for_should_not
288 289 290 291 292 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 288 def "expected given block not to yield successively with arguments, but yielded with expected arguments" + "\nexpected not: #{@expected.inspect}" + "\n got: #{@actual.inspect} (compared using === and ==)" end |
- (Boolean) matches?(block)
276 277 278 279 280 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 276 def matches?(block) @probe = YieldProbe.probe(block) @actual = @probe.successive_yield_args args_match? end |