[rspec-users] Spec'ing via features

Raimond Garcia lists at ruby-forum.com
Mon Nov 24 14:49:20 EST 2008


Hi guys,

I'm having trouble figuring out where the line between writing a spec or 
a feature is.
Since I started with rspec stories, I have the idea that stories where 
just the evolution of specs.
My main reason for this was the re-usability of steps throughout 
stories, which I think is great.
On contraire, at our company, we have lots of very similar specs,
that check very similar things over and over,
which doesn't' seem to bother anyone too much, apart from myself.
They are simply not DRY.

I have the idea that using steps and resources we can come up with a 
very coherent test framework, that will
simplify the most common tests, and allow us to concentrate on the 
really specific things of our project.

I can vouch this idea with a very helpful number of steps
(which I'm still polishing with the help of my colleagues and would love 
to share and extend)
Which either check things in the database or in the views, in a highly 
reusable manner,
thus with 2 simple steps and a non-complex regexp,
you can basically substitute hundreds of lines of specs that do the same 
job.

Now that I'm at it, let me point out controller and view specs, which if 
I'm still up to date with the list,
have become less important to test with specs, either because we are 
writing more restful applications,
or because Then steps and view specs cover the same areas of testing.
Now the ones that are left to discuss further are the model specs, or 
unit tests, which is where I see the most repeated test code,
and believe it could be dryed up by using the concept behinds steps.

Last but not least, I don't see why we should follow the MVC pattern of 
rails to structure our test code.
It feels wrong to have to move all those things around when you refactor 
(I know this is not a problem in static languages,
but still, there is a clear coupling between implementation code and 
test code which I'm concerned with)

Looking forward to your comments and suggestions.

Kind Regards,


Raimond Garcia

-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list