[rspec-users] Working outside-in with Cucumber and RSpec

Ashley Moran ashley.moran at patchspace.co.uk
Sun Oct 26 18:09:38 EDT 2008


On Oct 26, 2008, at 9:09 pm, Matt Wynne wrote:

> I don't know. I've got inheritance in my controllers, for example I  
> have a MediaController which is subclassed by ImagesController and  
> VideosController. The specs allowed me to factor out this base class.
>
> I think controllers are OK for doing BDD:
>
> describe "the show action"
> 	describe "when the video is for an artist"
> 		describe "when the video cannot be found"
> 		describe "when the video exists in the database"
> 	describe "when the video is for a concert"
>
> etc.

Hmm, what's the code like behind that?  I try to avoid inheritance, or  
at least rarely feel the need for it.  There are many ways to  
implement those specs, and one of them involves a lot of ifs and  
cases.  (A valid if-statement would probably be for "when the video  
cannot be found"	and "when the video exists in the database".)


> TBH, I have only just begun to glimpse the idea that cucumber might  
> mean I don't need to get 100% coverage from unit-level specs... so I  
> may just need more time to get my head around the idea.

Me too, especially when multiple content types and authentication  
schemes come into play... not got that far in my current projects  
though.


> I guess it also depends on the rest of your team: it sounds as  
> though David can trust the rest of his team to write well designed  
> code - it's just him! Personally I feel I need to set the rest of my  
> team a good example while they get through the 'shu' stage. Pat -  
> are you going solo too?


I'm in an unusual situation in this sense.  One of my Merb projects is  
purely personal, right now.  So for that I just want to make my app  
work, and the code not to cause me grief.  The other is a two day a  
week BDD coaching/pair programming development with an otherwise solo  
developer.  So I have to make the specs damn near perfect, because  
it's all the RSpec he's seen.  Due to Merb still being a bit of an  
unknown, that's making me lean towards neurotic perfectionism in my  
own code, at the moment.

And I know just as soon as I've made them all perfect, David will  
redefine perfection again :)

Ashley

-- 
http://www.patchspace.co.uk/
http://aviewfromafar.net/



More information about the rspec-users mailing list