Topic: rspec crud controllers

I've just started doing BDD and TDD with cucumber and rspec on a new Rails 3 project. It's a large project which has a lot of CRUD controllers which basically do the same thing.

I written my 270 lines of rspec to test all the CRUD for my first controller of many and now I'm thinking that I want to do the same again for the next controllers.

I came across this link to DRY up my rspec:
http://edspencer.net/2008/08/drying-up- … specs.html

Is there a common or better way to do this?

Re: rspec crud controllers

Its a good approach. But if you have many controllers doing the same thing, you might consider drying it up. Take a look at this gem:
https://github.com/josevalim/inherited_resources

Re: rspec crud controllers

Thanks that does look like a very interesting approach. As this is a plugin with all it's own tests would it right to say I don't need to write any rspec tests for the standard CRUD in which I'm inheriting from this plugin?

Would it be best to use my Cucumber tests for testing standard CRUD and write rspec for any differences I make to my controller?

Re: rspec crud controllers

Yeah, thats how I do it - I just don't unit test controllers that are pure inherited_resources.
Cucumber tests are still a good idea. Testing differences from default behavior too.