From: Jim Weirich Date: 2006-06-06T06:08:06+09:00 Subject: Re: Need help with TDD, stubs and mocks unknown wrote: > On Jun 5, 2006, at 10:57 AM, Jim Weirich wrote: > >> >> def test_comparison >> thing = Thing.new >> thing.methodA >> thing.methodB >> assert_equal ExpectedResult, thing.methodC >> end > > Jim, > > thanks for your response. I do need some additional clarification on > this final point. The way I see your answer, you are NOT suggesting I > pass instance variables as parameters. I don't have enough information to make a recommendation one way or another. As a general rule of thumb, I would try to avoid order dependencies in methods, but if you have them, its not an inordinate burden for testing. > Instead, I should enforce the > order of operations for my methods and allow them "global" (in this > class instance) access to the instance variables. Your use of "global" is confusing to me. To you mean access to the variable outside of the object? Without further details, all one can do is make general statements. My recommendation: determine the responsibilities of the object and make sure the methods for that object are adequate to allow it to perform those responsibilities. -- Jim Weirich -- Posted via http://www.ruby-forum.com/.