Spec templates

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

On Thu, Apr 15, 2010 at 5:32 PM, Phillip K.
[email protected] wrote:

spec/templates
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.

Cheers,
-foca

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

Cheers,
-foca

That’s a good idea, foca. Thanks. I’ll give it a try.

Peace,
Phillip

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs