RSpec Autotest for Standalone Projects

Posted by Nick Sieger Tue, 30 Jan 2007 02:16:00 GMT

I know there has been some demand out there for a version of my RSpec Autotest Rails plugin that works with standalone (non-Rails) projects, so I finally caved and coded it up. I really hope this does finally get accepted as a patch to ZenTest (nudge, nudge), but until it gets a more standard release, do try it out:

  1. Ensure you have ZenTest installed (gem install ZenTest).
  2. Download the rspec_autotest.rb file here and put it in the spec directory of your project.
  3. Add this snippet of code into your Rakefile, and rake spec:autotest as usual.
namespace :spec do
  task :autotest do
    require './spec/rspec_autotest'
    RspecAutotest.run
  end
end

Once again, happy spec’ing, and let me know of any issues you have with it.

Tags , ,  | 1 comment | no trackbacks

Comments

  1. Avatar Victor said about 15 hours later:

    Love it! Thanks, Nick.

    One feature request: It would be nice to have a task to run it against the spec server which is much faster.

    Something like:

    namespace :spec do
      task :autotest do
        require_rspec_autotest
        RspecOnRailsAutotest.run
      end
    
      task :autotest_drb do
        require_rspec_autotest
        autotest = RspecOnRailsAutotest.new
        autotest.spec_command = "drbspec --diff unified"
        autotest.run
      end
    
      private
    
      def require_rspec_autotest
        require File.join(File.dirname(__FILE__), '..', 'lib', 'rspec_autotest')
      end
    end
    

Trackbacks

Use the following link to trackback from your own site:
http://blog.nicksieger.com/articles/trackback/204