66: def expects(expected_methods_vs_return_values)
67: if expected_methods_vs_return_values.to_s =~ /the[^a-z]*spanish[^a-z]*inquisition/i
68: raise Mocha::ExpectationError.new('NOBODY EXPECTS THE SPANISH INQUISITION!')
69: end
70: if frozen?
71: raise StubbingError.new("can't stub method on frozen object: #{mocha_inspect}", caller)
72: end
73: expectation = nil
74: mockery = Mocha::Mockery.instance
75: iterator = ArgumentIterator.new(expected_methods_vs_return_values)
76: iterator.each { |*args|
77: method_name = args.shift
78: mockery.on_stubbing(self, method_name)
79: method = stubba_method.new(stubba_object, method_name)
80: mockery.stubba.stub(method)
81: expectation = mocha.expects(method_name, caller)
82: expectation.returns(args.shift) if args.length > 0
83: }
84: expectation
85: end