So you’re using RSpec for your specifications, HAML for your views and Factory Girl to build your test models (and maybe even Factory Girl on Rails to quickly load ‘em – it’s nice, try it).

And everything is good and you feel good and you’re sure that you’re just damn good, but something is still bad… It’s that damned default scaffold generator that comes with Rails and just doesn’t want to use all that candy stuff, and instead builds those ugly mocks and pushes ERb templates here and there! And you have to rewrite your specs and templates every time, or maybe you’ve just stopped using that generator at all. So what do we do in these cases? Why, of course – we build our own generator!

So here you go – grab that Factory Haml RSpec Scaffold from GitHub and put it as a plugin under your vendor/plugins directory. Remember how to do it right? Of course – as a submodule!

$ git submodule add git://github.com/morhekil/factory_haml_rspec_scaffold.git vendor/plugins/factory_haml_rspec_scaffold

And just use it instead of those dull old Rails scaffolds:

$ ./script/generate factory_haml_rspec_scaffold Invoice amount:float info:string

Want to take a look at the results first? No problem – here’s a gist with controller’s spec and index HAML template.