[rspec-users] Spec templates

Nicolás Sanguinetti godfoca at gmail.com
Thu Apr 15 16:39:27 EDT 2010

On Thu, Apr 15, 2010 at 5:32 PM, Phillip Koebbe <phillipkoebbe at gmail.com> wrote:
>  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?

You could always define your own generators with your own templates.
I'd probably try that first and see how well it works.


> Peace,
> Phillip
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list