From: Mike Dalessio Date: 2009-08-06T22:24:18+09:00 Subject: Re: Testing with Mechanize --00163642708451f28c0470790965 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I think maybe you're trying to test at the wrong level. Unless you're actually testing the behavior of Mechanize, then I would suggest abstracting to a higher level. Wrap your form-submission code in a method, and then mock or stub the method out with expected parameters, and perhaps return the contents of an HTML fixture file. I know when I go through this sort of exercise, it forces me to think about refactoring the code to be more easily testable, which is a nice side-effect that usually improves long-term maintainability. 2009/8/5 Michael Boutros > Hello, > > I'm trying to jump onto the habit of testing and I'm not finding to too > easy because most of the code I write has to do with third party web > services. My current dilemma is how to stub or mock a Mechanize object > that deals with submitting forms. Can anyone else who tests with > Mechanize please provide some guidance? > > Thanks, > Michael Boutros > -- > Posted via http://www.ruby-forum.com/. > > -- mike dalessio mike@csa.net --00163642708451f28c0470790965--