[rspec-users] Spec templates

Phillip Koebbe phillipkoebbe at gmail.com
Thu Apr 15 16:32:56 EDT 2010


  David et al,

Has anyone ever toyed with the idea of templates for specs? I have a 
relative consistent way of specing models, controllers, etc, and 
invariably, I have to delete the stock code that the rspec generator 
creates and add a bunch of stuff that I always want. I was just thinking 
it would be nice of there were a way to have my own template for models, 
controllers, etc and not have to do so much repetitive work for every 
spec. Maybe it could be as easy as having a folder such as

spec/templates

and in that have

model_spec.rb
controller_spec.rb
view_spec.rb
helper_spec.rb

There would have to be a bit of standardization regarding placeholders 
in those files, but it shouldn't be unbearable, especially considering 
what it could offer.

Thoughts?

Peace,
Phillip


More information about the rspec-users mailing list