and_return(*values, &return_block) public

No documentation

This method has no description. You can help the RSpec community by adding new notes.

Hide source
# File lib/spec/mocks/message_expectation.rb, line 47
      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 }
        # Ruby 1.9 - see where this is used below
        @ignore_args = !block_given?
      end
Register or log in to add new notes.