Anyone have experience writing custom Rails generators? Do you test them?

I would like to experiment with writing a my own generator that I
might want to eventually bundle into it’s own gem. What I would like
to know if it’s feasible or considered best practice to write specs/
tests for your generator, and if so, any tips or examples you can
point me to?

On Nov 30, 10:56am, Michael E. [email protected] wrote:

I would like to experiment with writing a my own generator that I
might want to eventually bundle into it’s own gem. What I would like
to know if it’s feasible or considered best practice to write specs/
tests for your generator, and if so, any tips or examples you can
point me to?

You certainly can test them, for example here are the specs for the
rspec generators:
https://github.com/rspec/rspec-rails/tree/master/spec/generators

Fred

On Wed, Nov 30, 2011 at 05:56, Michael E.
[email protected] wrote:

know if it’s feasible or considered best practice to write specs/
tests for your generator,

Of course! It’s considered best practice to write spec/tests for
everything! :slight_smile:

-Dave


LOOKING FOR WORK! What: Ruby (on/off Rails), Python, other modern
languages.
Where: Northern Virginia, Washington DC (near Orange Line), and remote
work.
See: davearonson.com (main) * codosaur.us (code) * dare2xl.com
(excellence).
Specialization is for insects. (Heinlein) - Have Pun, Will Babble!
(Aronson)

Cool, thanks a lot for the examples, I’m amazed by how clean and
readable these specs are.

On Nov 30, 4:22pm, Frederick C. [email protected]

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