I''ve never really done BDD or TDD. I''ve done various tests but not really allowing the tests to direct the development I''ve read various books and I bought the RSpec book and was reading it -- up to chapter 4. Today while torquing with a toy Rails project, a small change mushroomed into a major revamp due to new ideas I''ve picked up from DCI, Objects on Rails, and other sources. I don''t really have the tests like I should to verify my changes work so this seemed like a good opportunity to really do the revamp using BDD with RSpec and Cucumber. The toy Rails project is specifically intended to teach me new things. My question is: would it work for me to just jump up to chapter 19 where the RSpec book starts talking about Rails? Or would it be better (less frustration, etc) if I plowed through the other chapters? Any other hints or suggestions would be welcomed as well. Thank you, Perry Smith
Plow through the other chapters. They cover the basics of BDD using Rspec, as would apply to any project written in Ruby. The later chapters talk about the specific application to Rails, but you''ll need the background from the earlier chapters to make best use of it. On Friday, November 23, 2012 7:26:09 PM UTC-8, Perry Smith wrote:> > I''ve never really done BDD or TDD. I''ve done various tests but not really > allowing the tests to direct the development > > I''ve read various books and I bought the RSpec book and was reading it -- > up to chapter 4. > > Today while torquing with a toy Rails project, a small change mushroomed > into a major revamp due to new ideas I''ve picked up from DCI, Objects on > Rails, and other sources. I don''t really have the tests like I should to > verify my changes work so this seemed like a good opportunity to really do > the revamp using BDD with RSpec and Cucumber. The toy Rails project is > specifically intended to teach me new things. > > My question is: would it work for me to just jump up to chapter 19 where > the RSpec book starts talking about Rails? Or would it be better (less > frustration, etc) if I plowed through the other chapters? > > Any other hints or suggestions would be welcomed as well. > > Thank you, > Perry Smith > > _______________________________________________ > rspec-users mailing list > rspec... at rubyforge.org <javascript:> > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20121123/0dca6a00/attachment.html>
On 24 November 2012 03:24, Perry Smith <pedzsan at gmail.com> wrote:> I''ve never really done BDD or TDD. I''ve done various tests but not really > allowing the tests to direct the development > > I''ve read various books and I bought the RSpec book and was reading it -- > up to chapter 4. > > Today while torquing with a toy Rails project, a small change mushroomed > into a major revamp due to new ideas I''ve picked up from DCI, Objects on > Rails, and other sources. I don''t really have the tests like I should to > verify my changes work so this seemed like a good opportunity to really do > the revamp using BDD with RSpec and Cucumber. The toy Rails project is > specifically intended to teach me new things. > > My question is: would it work for me to just jump up to chapter 19 where > the RSpec book starts talking about Rails? Or would it be better (less > frustration, etc) if I plowed through the other chapters? > >It might well do, however Chapters 21 and 22 are very webrat centred, and you really want to use Capybara instead. Chapter 23 isn''t really necessary if you are using Cucumber and the same could be said for Chapter 24. Chapter 25 is where you should start using RSpec with rails. The book is quite old now. It still has great value for understanding core BDD principles, and for covering the range of things you can do with RSpec, but if you use it as a guide to follow step by step without sufficient background understanding you might get bitten by its age. The Cucumber book might be better to use with Rails for this. Finally the most important bit of the book is the diagram on page 29. Understanding that cycle is key to doing BDD well, and the codebreaker example does have the merit of being a low overhead way of examining this cycle in great detail, without all the baggage that Rails brings HTH and Good luck Andrew> Any other hints or suggestions would be welcomed as well. > > Thank you, > Perry Smith > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- ------------------------ Andrew Premdas blog.andrew.premdas.org -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20121124/1daebf63/attachment.html>
If you want to learn fast, you can also do the codeschool''s course here : http://www.codeschool.com/courses/testing-with-rspec. Fun and fast. Good luck. If you want to share the code on github, contact me and I can comment your project. Le 2012-11-24 04:00, Andrew Premdas a ?crit :> > > On 24 November 2012 03:24, Perry Smith <pedzsan at gmail.com > <mailto:pedzsan at gmail.com>> wrote: > > I''ve never really done BDD or TDD. I''ve done various tests but > not really allowing the tests to direct the development > > I''ve read various books and I bought the RSpec book and was > reading it -- up to chapter 4. > > Today while torquing with a toy Rails project, a small change > mushroomed into a major revamp due to new ideas I''ve picked up > from DCI, Objects on Rails, and other sources. I don''t really > have the tests like I should to verify my changes work so this > seemed like a good opportunity to really do the revamp using BDD > with RSpec and Cucumber. The toy Rails project is specifically > intended to teach me new things. > > My question is: would it work for me to just jump up to chapter 19 > where the RSpec book starts talking about Rails? Or would it be > better (less frustration, etc) if I plowed through the other chapters? > > > It might well do, however Chapters 21 and 22 are very webrat centred, > and you really want to use Capybara instead. Chapter 23 isn''t really > necessary if you are using Cucumber and the same could be said for > Chapter 24. Chapter 25 is where you should start using RSpec with rails. > > The book is quite old now. It still has great value for understanding > core BDD principles, and for covering the range of things you can do > with RSpec, but if you use it as a guide to follow step by step > without sufficient background understanding you might get bitten by > its age. The Cucumber book might be better to use with Rails for this. > > Finally the most important bit of the book is the diagram on page 29. > Understanding that cycle is key to doing BDD well, and the codebreaker > example does have the merit of being a low overhead way of examining > this cycle in great detail, without all the baggage that Rails brings > > HTH and Good luck > > Andrew > > Any other hints or suggestions would be welcomed as well. > > Thank you, > Perry Smith > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org <mailto:rspec-users at rubyforge.org> > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > -- > ------------------------ > Andrew Premdas > blog.andrew.premdas.org <http://blog.andrew.premdas.org> > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20121124/b8ed50c5/attachment.html>
On Nov 24, 2012, at 3:00 AM, Andrew Premdas wrote:> The book is quite old now. It still has great value for understanding core BDD principles, and for covering the range of things you can do with RSpec, but if you use it as a guide to follow step by step without sufficient background understanding you might get bitten by its age. The Cucumber book might be better to use with Rails for this.I thought the book might be old so I checked the date. The last update was Sep. 2012 so I thought it was going to have been updated. But it is still talking about webrat instead of Capybara. I took your advice and scored me a Cucumber book. I have way plenty to read. Hopefully I can surf the books and web and come up to speed. I think I need to start "doing"... I''ve read and re-read various tutorials already. On a different note: I walked through Chapter 19 last night and when I did "rake cucumber", an old friend came up to bite me. I use PostgreSQL and I want to have foreign keys and as many constraints down in the database as possible. In fact, I''ve written a gem to help with this: https://github.com/pedz/activerecord_constraints "rake cucumber" had some issues which I had to work through. Fortunately, I''ve been here before so it wasn''t that hard. Back when I first started Rails (2006) and fighting with fixtures and the general fact that the Rails community scoffs at database constraints, my experience with the testing aspect of rails was horrible. Every turn I took I was hit with something I had to fix and overcome. "fixtures" back then and the other parts of the Rails test stack fought against me every step of the way. I also deeply questioned any group who assumed their application could actually implement constraints rather than putting them down in the database proper. I very much hope this experience is different. One thing I''m hoping to achieve / figure out is what "Uncle Bob" outlined in his "Forgotten Years" video where the application itself can be extracted away from the database and tested on its own. The other books I''ve been reading vaguely point the way for this but I''m still not clear. I don''t think I''ll be clear on how to do it until I actually do it. Thank you all for the help and suggestions and sorry (again) for the duplicate post. pedz -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20121124/977a86ac/attachment-0001.html>