class RSpec::Matchers::DelegateMatcher::Dispatcher

Attributes

expected[RW]
return_value[RW]

Public Class Methods

new(expected) click to toggle source
# File lib/delegate_matcher/dispatcher.rb, line 7
def initialize(expected)
  self.expected = expected
end

Public Instance Methods

block() click to toggle source
# File lib/delegate_matcher/dispatcher.rb, line 18
def block
  @block ||= expected.block.is_a?(Proc) ? expected.block : proc {}
end
call() click to toggle source
# File lib/delegate_matcher/dispatcher.rb, line 11
def call
  args = expected.args
  args = [] if args && args[0].is_a?(Mocks::ArgumentMatchers::NoArgsMatcher)

  self.return_value = expected.subject.send(expected.delegator_method_name, *args, &block)
end