[rspec-users] noob question (trying to understand view specs vs webrat and cucumber)...

Tom Stuart tom at experthuman.com
Thu Jul 16 02:29:33 EDT 2009


Hi Chris,

On 16 Jul 2009, at 06:46, internetchris  
<chris at silhouettesolutions.net> wrote:
> So would I be correct in saying that I should develop all of my spec
> tests first, and then finish it up by running some cucumber tests?

You can do whatever you like. This is certainly a valid way of  
working, and as a testing strategy it would definitely help you to  
catch certain kinds of bugs that you might miss with RSpec alone.

However, BDD is about the design process itself, not (just) testing,  
and the BDD people (and the RSpec book) recommend a process where you  
start at the Cucumber level, i.e. think first about an overall feature  
that you want your application to have, and write that feature up as  
Cucumber scenarios. Although those scenarios will all fail (because  
you haven't written any code yet), they represent what you're aiming  
for. To get them to pass you "drop down" into RSpec and write some  
more detailed specs for the behaviour you think you'll need to get the  
Cucumber scenarios passing, and actually implement the code (to make  
the specs pass) as you go. When all the specs pass then the Cucumber  
feature will also pass unless you've forgotten something. Then you  
move onto writing another Cucumber feature and the design/implement  
cycle continues.

I'm pretty sure there's a diagram of this process (concentric circles  
with arrows) in the first couple of chapters of the RSpec book.

Cheers,
-Tom


More information about the rspec-users mailing list