David J Rice

The blog of freelance Designer & Developer, David Rice.

12 Aug 2007

Recently I’ve been thinking about updating some test cases to the excellent RSpec, I really didn’t want to have to manually create all the spec files so I put it off… until today when I finally got some inspiration by way of the Pivotal Labs Blog. With a bit of work I was able to put together this plugin, to the point where it would generate specs that would pass, woo! That was with a small-ish application, with any significant sized I have tried it out on it’s taken a while to massage the generated specs so they will run. So if you’ve been putting off the move to RSpec you need wait no longer! :)

script/plugin install \
http://svn.davidjrice.co.uk/svn/projects/plugins/test_unit_to_rspec_converter
rake convert_to_rspec

Before you run the command, take heed as it will overwrite files in the spec directory of your application if they already exist!

Update If this is your first time using rspec then do the following too.

sudo gem install rspec
script/plugin install \
svn://rubyforge.org/var/svn/rspec/tags/REL_1_0_5/rspec_on_rails
script/generate rspec
rake spec 

If you do try it out let me know how this goes for you, with your help we can make the conversion process better! Comments and suggestions welcome.

David Rice

If you need help with the Design, Build, Management, Hosting or Support of your project do get in touch, I'd love to hear from you!

Recently

Archive