user1543863
user1543863

Reputation:

Real example on how to do TDD/BDD with Rspec and Cucumber

I find it not so easy as one might think to start with TDD in Rails. I've searched for some examples but no-one really explains how to do TDD/BDD with Rspec AND cucumber. They usually use an old version of rspec, or prefer one on the other (so you find cucumber tests and rspec tests separated). And by the way the say what to do, but the real process is often not explained at all (I've read a lot on make them work togheter with Capybara, but only once on how to proceed on bdd with them).

I'd like to know how to use them togheter, how to avoid test duplication (disabling view specs and other tests that should be done with cucumber), and maybe an explanation of what not to test (for example I find it useless to test the HTML output in most cases, it can be useful to test if you're logging in to match what you're seeing, for example a flash message).

Can you please provide a step-by-step list of how do you proceed with BDD using this two tools togheter? It would be nice a fresh tutorial (using latest versions) or maybe a screencast.

Thanks.

Upvotes: 0

Views: 602

Answers (1)

systho
systho

Reputation: 1161

I highly recommend you the Rspec book which is exactly what you are looking for :

It explains how to use Rspec and Cucumber together with a simple 2 loops process : The outer big loop is a Test - Code - Refactor process you do with cucumber and each step is made of multiple iteration of a Test - Code - Refactor process you do with Rspec.

That books explains at the same time how and when to use each of the two tools.

If you want a broader vision of TDD-BDD, I also suggest you the GOOS book which is more language/tool agnostic and more process oriented.

Upvotes: 5

Related Questions