This is a great question as the TDD orthodoxy was developed in a land without HTML or CSS and often skips over the issues of testability and brittleness and "could this really break in a meaningful way?"
You should definitely test-drive your models and controllers. But should you test-drive your views? Maybe if there's logic in there. But if there's logic in the views, maybe that logic should move to the controllers where it's easier to test. Then the controllers can either select which view to render, or pass on variables to the view to tell it what to do. That's because testing HTML&CSS tends to be very brittle. You can make a non-functional change (like changing an H2 to an H3) and break your whole test suite. Ugh. That pain encourages you to just ignore or remove the tests, so what's the use? btw your first option:"Build the basics of the app without testing, confirm that it works visually" is what XP calls a "spike". After you do that, you're supposed to throw it away and start from scratch with tests. (And yeah, maybe copy some code over from your spike, but always with a red test first.) -A > On Jul 23, 2015, at 8:18 PM, Askar <[email protected]> wrote: > > Hello! > > Nowadays I'm reading Rails 4 in Action book and I like it very much. > > They're using TDD&BDD first, then building the rest as test goes. > > I wonder which approach is better: Build the basics of the app without > testing, confirm that it works visually and then making TDD & BDD? > > Or start straight away from TDD & BDD. > > In the book, rspec, factorygirls and capybara used. > -- > You received this message because you are subscribed to the Google Groups > "rspec" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/rspec/771c357b-5361-439e-83d1-51e976d0db3f%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/B20B0BCD-A161-42A6-8E5B-4776094FBC06%40gmail.com. For more options, visit https://groups.google.com/d/optout.
