[rspec-users] Problem with Custom matcher and Blocks

Matt Wynne matt at mattwynne.net
Thu Apr 2 18:18:50 EDT 2009

On 2 Apr 2009, at 22:21, Zach Dennis wrote:

> Matt, can you say where you gauge your app?
> - Are there many little scenarios covering the details of the page?
> - Are the scenarios comprised of many steps which look at all aspects
> of the page?
> - Are the step definitions detail oriented? e.g.: looking at the
> project looks at all of the pieces of information it should be
> displaying
> I'm really interested in this topic as I think I've seen when Cucumber
> is relied on too much and I've definitely seen where it's been relied
> on too little. So naturally I'm interested to find out more about
> people's projects to help gauge where things fall on the continuum,

What we have are a relatively small number of pages that have a lot of  
different stuff on them, and that stuff depends a lot on the context.

So for example, a Concert page will show media about that concert, but  
we juggle the media around depending on what there happens to be -  
we'll prefer to show a poster if someone has uploaded one, but  
otherwise we'll show a photo if there's one of those. Then, depending  
on the aspect (landscape / portrait) of the photo, we'll use a  
different grid layout for the media and show different numbers of them.

All these little rules get complex pretty quickly, and there are two  
advantages I've found for expressing them in Cucumber.
(1) They're super easy to read for both the CSS / markup guy who  
fiddles with the layout, the product owner, and anyone else who wants  
to get a handle on them
(2) They're totally de-coupled from the implementation, which means I  
can start with some ugly thing that filters and juggles arrays, while  
we figure out exactly how we want it to work, then later optimize it  
into a database query once the requirements have solidified.

This is the key thing for me about driving everything out from  
acceptance tests - you get absolute flexibility about your  
implementation with the confidence to know you can change whatever you  
like and you're still covered. The trade-off I guess is the length of  
the build, and possibly the maintainability of the test suite if  
people get sloppy about keeping it tidy. The first is definitely an  
issue for us now, but the second is not really a problem at all for us  
as yet - 910 scenarios and counting..! :)

So to answer your questions, we would parts of the behaviour of each  
page on the site as different features - so I guess this maps to what  
you call 'many little scenarios covering the details of the page'

If you email me directly I'll send you a beta invite and you can take  
a look for yourself :)

Matt Wynne

More information about the rspec-users mailing list