Class: RSpec::Mocks::AndReturnImplementation

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/mocks/message_expectation.rb

Overview

Handles the implementation of an `and_return` implementation.

Instance Method Summary (collapse)

Constructor Details

- (AndReturnImplementation) initialize(values_to_return)



560
561
562
# File 'lib/rspec/mocks/message_expectation.rb', line 560

def initialize(values_to_return)
  @values_to_return = values_to_return
end

Instance Method Details

- (Object) call(*args_to_ignore, &block)



564
565
566
567
568
569
570
# File 'lib/rspec/mocks/message_expectation.rb', line 564

def call(*args_to_ignore, &block)
  if @values_to_return.size > 1
    @values_to_return.shift
  else
    @values_to_return.first
  end
end