From: Phlip Date: 2008-08-03T23:03:45+09:00 Subject: Re: unit testing advice James Britt wrote: > http://www.infoq.com/interviews/Dave-Astels-and-Steven-Baker# > > Quote: > > I guess you don't use the Rails code generation then. > > Steven: No, not at all. I use TDD to generate code manually. > > So you don't even do model generation with Rails? > > Steven: Not at all. Especially when I'm pairing with somebody who's > never used Rails before or who has never done TDD before I find it > especially important not to rely on the generator to give me test stubs, > to give me things that I should know or that I should be providing for > myself. When the failings specifications tell me that I need it, because > that would be contradicting what I'm trying to teach. I don't know if we are discussing the same thing. This Rails command... script/generate model MyModel ...does not create "stubs". It creates all the files that back up a Model, including its my_model_test.rb and fixtures/my_models.yml files. I can't imagine not using it, because all it saves you is a lot of rote typing. Writing a test that fails because "fixtures/my_models.yml" does not exist is not TDD, because that's not production code. I often write a test that fails because MyModel does not exist yet, to start the cycle. I think Dave and Steve are discussing some tool that reads Ruby classes and spits out stubbed test cases for each method. -- Phlip