method
and_return
rspec latest stable - Class:
Spec::Mocks::BaseExpectation
and_return(*values, &return_block)public
No documentation available.
# File lib/spec/mocks/message_expectation.rb, line 50
def and_return(*values, &return_block)
Kernel::raise AmbiguousReturnError unless @method_block.nil?
case values.size
when 0 then value = nil
when 1 then value = values[0]
else
value = values
@consecutive = true
@expected_received_count = values.size if !ignoring_args? &&
@expected_received_count < values.size
end
@return_block = block_given? ? return_block : lambda { value }
end