123456789_123456789_123456789_123456789_123456789_

Class: RSpec::Mocks::AndInvokeImplementation Private

Relationships & Source Files
Inherits: Object
Defined in: rspec-mocks/lib/rspec/mocks/message_expectation.rb

Overview

Handles the implementation of an and_invoke implementation.

Other Constraints

Constructor Details

.new(procs_to_invoke) ⇒ AndInvokeImplementation

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/message_expectation.rb', line 738

def initialize(procs_to_invoke)
  @procs_to_invoke = procs_to_invoke
end

Instance Method Details

#call(*args, &block)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/message_expectation.rb', line 742

def call(*args, &block)
  proc = if @procs_to_invoke.size > 1
           @procs_to_invoke.shift
         else
           @procs_to_invoke.first
         end

  proc.call(*args, &block)
end