class RSpec::Matchers::BuiltIn::YieldWithArgs

@api private Provides the implementation for ‘yield_with_args`. Not intended to be instantiated directly.

Public Class Methods

# File rspec-expectations/lib/rspec/matchers/built_in/yield.rb, line 180
def initialize(*args)
  @expected = args
end

Public Instance Methods

@private

# File rspec-expectations/lib/rspec/matchers/built_in/yield.rb, line 212
def description
  desc = 'yield with args'
  desc = "#{desc}(#{expected_arg_description})" unless @expected.empty?
  desc
end

@private

# File rspec-expectations/lib/rspec/matchers/built_in/yield.rb, line 197
def does_not_match?(block)
  !matches?(block)
end

@private

# File rspec-expectations/lib/rspec/matchers/built_in/yield.rb, line 202
def failure_message
  "expected given block to yield with arguments, but #{positive_failure_reason}"
end

@private

# File rspec-expectations/lib/rspec/matchers/built_in/yield.rb, line 207
def failure_message_when_negated
  "expected given block not to yield with arguments, but #{negative_failure_reason}"
end

@private

# File rspec-expectations/lib/rspec/matchers/built_in/yield.rb, line 185
def matches?(block)
  @args_matched_when_yielded = true
  @probe = YieldProbe.new(block) do
    @actual = @probe.single_yield_args
    @actual_formatted = actual_formatted
    @args_matched_when_yielded &&= args_currently_match?
  end
  @probe.probe
  @probe.yielded_once?(:yield_with_args) && @args_matched_when_yielded
end

@private

# File rspec-expectations/lib/rspec/matchers/built_in/yield.rb, line 219
def supports_block_expectations?
  true
end

@private

# File rspec-expectations/lib/rspec/matchers/built_in/yield.rb, line 224
def supports_value_expectations?
  false
end