class RSpec::Matchers::BuiltIn::YieldSuccessiveArgs
@api private Provides the implementation for `yield_successive_args`. Not intended to be instantiated directly.
Public Class Methods
new(*args)
click to toggle source
# File lib/rspec/matchers/built_in/yield.rb, line 352 def initialize(*args) @expected = args end
Public Instance Methods
description()
click to toggle source
@private
# File lib/rspec/matchers/built_in/yield.rb, line 379 def description desc = "yield successive args" desc << "(#{expected_arg_description})" desc end
does_not_match?(block)
click to toggle source
# File lib/rspec/matchers/built_in/yield.rb, line 364 def does_not_match?(block) !matches?(block) && @probe.has_block? end
failure_message()
click to toggle source
@private
# File lib/rspec/matchers/built_in/yield.rb, line 369 def failure_message "expected given block to yield successively with arguments, but #{positive_failure_reason}" end
failure_message_when_negated()
click to toggle source
@private
# File lib/rspec/matchers/built_in/yield.rb, line 374 def failure_message_when_negated "expected given block not to yield successively with arguments, but #{negative_failure_reason}" end
matches?(block)
click to toggle source
@private
# File lib/rspec/matchers/built_in/yield.rb, line 357 def matches?(block) @probe = YieldProbe.probe(block) return false unless @probe.has_block? @actual = @probe.successive_yield_args args_match? end
supports_block_expectations?()
click to toggle source
@private
# File lib/rspec/matchers/built_in/yield.rb, line 386 def supports_block_expectations? true end
Private Instance Methods
args_match?()
click to toggle source
# File lib/rspec/matchers/built_in/yield.rb, line 392 def args_match? values_match?(@expected, @actual) end
expected_arg_description()
click to toggle source
# File lib/rspec/matchers/built_in/yield.rb, line 396 def expected_arg_description @expected.map { |e| description_of e }.join(", ") end
negative_failure_reason()
click to toggle source
# File lib/rspec/matchers/built_in/yield.rb, line 408 def negative_failure_reason return "was not a block" unless @probe.has_block? "yielded with expected arguments" "\nexpected not: #{surface_descriptions_in(@expected).inspect}" "\n got: #{actual_formatted}" end
positive_failure_reason()
click to toggle source
# File lib/rspec/matchers/built_in/yield.rb, line 400 def positive_failure_reason return "was not a block" unless @probe.has_block? "yielded with unexpected arguments" "\nexpected: #{surface_descriptions_in(@expected).inspect}" "\n got: #{actual_formatted}" end