class RSpec::Matchers::BuiltIn::YieldWithArgs

Public Class Methods

new(*args) click to toggle source
# File lib/rspec/matchers/built_in/yield.rb, line 109
def initialize(*args)
  @expected = args
end

Public Instance Methods

description() click to toggle source
# File lib/rspec/matchers/built_in/yield.rb, line 127
def description
  desc = "yield with args"
  desc << "(" + @expected.map { |e| e.inspect }.join(", ") + ")" if @expected.any?
  desc
end
failure_message_for_should() click to toggle source
# File lib/rspec/matchers/built_in/yield.rb, line 119
def failure_message_for_should
  "expected given block to yield with arguments, but #{positive_failure_reason}"
end
failure_message_for_should_not() click to toggle source
# File lib/rspec/matchers/built_in/yield.rb, line 123
def failure_message_for_should_not
  "expected given block not to yield with arguments, but #{negative_failure_reason}"
end
matches?(block) click to toggle source
# 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