waseem ahmad
2009-Jan-02 17:54 UTC
[rspec-users] How to write specs for already written parts of an application?
Hi, What should be my approach to write specs for the parts of an applications which are already written? How should I start writing tests for those models, controllers which were not generated using rspec_controller or rspec_model? Would you please point me to some tutorials for writing RSpec tests? Is there any IRC channel for RSpec users? -- Waseem RwrWrwRwrWrwRwrWrwRwrWrwRwwwwwwww............ Blog: http://babygnu.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090102/f9f9ccd2/attachment.html>
David Chelimsky
2009-Jan-02 18:02 UTC
[rspec-users] How to write specs for already written parts of an application?
On Fri, Jan 2, 2009 at 11:54 AM, waseem ahmad <cougar2149 at gmail.com> wrote:> Hi, > What should be my approach to write specs for the parts of an applications > which are already written? How should I start writing tests for those > models, controllers which were not generated using rspec_controller or > rspec_model? Would you please point me to some tutorials for writing RSpec > tests? Is there any IRC channel for RSpec users?#rspec on freenode Check out Michael Feathers'' Working Effectively with Legacy Code for learning how to get untested apps under test. General idea is to do it gradually over time. When you have a new requirement, figure out what code needs to change to add that requirement, and write characterization tests (high level tests using a tool like Cucumber) that characterize what the application already does. The WELC book provides strategies for determining which tests to add, but the idea is to add the least number of tests to cover the code you want to change, so when you start changing it you have confidence you''re not breaking things. Once you have the characterization tests in place, then you drive out the new code using TDD. HTH, David> > -- > Waseem > RwrWrwRwrWrwRwrWrwRwrWrwRwwwwwwww............ > Blog: http://babygnu.blogspot.com > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >