Rails scaffold generator that uses RSpec, HAML and FactoryGirl
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.