[rspec-users] Any tips on teaching BDD with RSpec?

Ashley Moran work at ashleymoran.me.uk
Wed Oct 17 12:27:25 EDT 2007


I hope this is not OT.  I'm training my replacement at work to do BDD  
Rails development.  He's done a CS/maths degree but has no  
professional programming experience, so he's never NOT done a project  
without BDD.  In a way I am jealous of his unspoilt situation :)

I've gone about things this way:
   * first teach him some Ruby (he did mainly Java at uni)
   * then let him write a small program (to a rough description I  
came up with) in Ruby however he wants
   * then teach him how to do BDD-driven OO
   * then let him re-write the sample app in a BDD way.

The app loads a YAML file that lists some URLs, fetches the pages off  
the interweb, extracts some data from the body of the spec, and  
outputs it to XML.  He's picking stuff up quick - he wrote it in  
about 1 1/2 days despite only learning Ruby last week.

I've gone through a really simple BDD example with him that is quite  
similar to part of the bigger app - he seems to follow the syntax of  
RSpec and flexmock, understands the concepts of full and partial  
mocks, etc.  But I've left him to rewrite his app along the same  
lines, and it's like there is a void.  Where before he just kept  
working at little bits until the output built up, now he's got the  
ability to isolate simple bits of code and develop/test them (eg  
formatting a <page> tag from a URL), he's taking longer.  He seems to  
be struggling to pick isolated pieces of functionality out of the  
bigger problem.

One thing I have done for him is write a functional test - one that  
runs the whole app "WebParse.run(infile, outfile)" black-box style,  
and compares the output in "outfile" to the output of his existing  
app (which we've decided between us is correct and suitable as a  
reference).  I'm not sure if this has helped or confused the issue.

Clearly there is something important I am not explaining, something I  
take for granted.  Does anyone have any ideas what? I was hoping  
someone else here has been through the experience of teaching BDD  
(RSpec or otherwise) from scratch and may be able to point me in the  
right direction.

Thanks for any advice

PS I haven't told him to subscribe to this list yet, so I'm safe to  
talk about him for a bit :o)


blog @ http://aviewfromafar.net/
linked-in @ http://www.linkedin.com/in/ashleymoran
currently @ work

More information about the rspec-users mailing list