flexmock (FlexMock::MockContainer)

         # File lib/flexmock/mock_container.rb, line 116
    116:     def flexmock(*args)
    117:       name = nil
    118:       quick_defs = {}
    119:       domain_obj = nil
    120:       safe_mode = false
    121:       model_class = nil
    122:       while ! args.empty?
    123:         case args.first
    124:         when :base, :safe
    125:           safe_mode = (args.shift == :safe)
    126:           domain_obj = args.shift
    127:         when :model
    128:           args.shift
    129:           model_class = args.shift
    130:         when String, Symbol
    131:           name = args.shift.to_s
    132:         when Hash
    133:           quick_defs = args.shift
    134:         else
    135:           domain_obj = args.shift
    136:         end
    137:       end
    138:       raise UsageError, "a block is required in safe mode" if safe_mode && ! block_given?
    139:
    140:       if domain_obj
    141:         mock = ContainerHelper.make_partial_proxy(self, domain_obj, name, safe_mode)
    142:         result = domain_obj
    143:       elsif model_class
    144:         id = ContainerHelper.next_id
    145:         result = mock = FlexMock.new("#{model_class}_#{id}", self)
    146:       else
    147:         result = mock = FlexMock.new(name || "unknown", self)
    148:       end
    149:       mock.should_receive(quick_defs)
    150:       yield(mock) if block_given?
    151:       flexmock_remember(mock)
    152:       ContainerHelper.add_model_methods(mock, model_class, id) if model_class
    153:       result
    154:     end