Scaffolding basic shoulda tests

2 views
Skip to first unread message

nfstern

unread,
Sep 27, 2009, 7:40:55 PM9/27/09
to shoulda
I've been working on a project and found myself repeatedly writing up
the same basic tests over and over after scaffolding out pieces of my
application.

I did a little digging and created two standard templates for the
Rails unit and functional tests which I would like to share. I don't
think this is a patch or a fix, it's more of an add-on.

Basically, what it does is to replace the unit and functional tests
generated by Rails with some standard unit and functional tests
leveraging shoulda for the standard crud functions.

Anyway, I think other people might find it useful (if they're using
FactoryGirl also) and want to get it into the hands of the Shoulda
maintainers.

Please contact me if there's any interest.

Thx

Josh Nichols

unread,
Sep 28, 2009, 2:16:07 PM9/28/09
to sho...@googlegroups.com
This sounds similar to what I did for shoulda_generator awhile back:
http://github.com/technicalpickles/shoulda_generator

It's worth noting this is probably getting stale though, as I've been
mostly using rspec with shoulda matchers instead of straight up
shoulda recently.

Dan Croak

unread,
Sep 28, 2009, 2:30:42 PM9/28/09
to sho...@googlegroups.com
This has been done a few times:

http://github.com/dancroak/blitz
http://github.com/vigetlabs/model_generator_with_factories
http://github.com/technicalpickles/shoulda_generator
http://github.com/ryanb/nifty-generators

Most recently, the Rails 3 generators have been re-worked so that you
can replace their output with custom RSpec/Shoulda/Factory Girl/etc.

http://blog.plataformatec.com.br/2009/07/creating-your-own-generators-with-thor/
--
Dan Croak
@Croaky
Reply all
Reply to author
Forward
0 new messages