DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Alexey has posted 28 posts at DZone. View Full User Profile

Continuous Testing For Ruby On Rails With Autotest And Rspec On Windows

05.24.2010
| 11683 views |
  • submit to reddit
        Install Growl: 
http://www.growlforwindows.com/gfw/about.aspx

Install following gems if you don't have them:
gem install autotest -v 4.2.10
gem install autotest-growl -v 0.2.4
gem install autotest-rails -v 4.1.0

gem install rspec -v 1.3.0
gem install rspec-rails -v 1.3.2
gem install test-unit -v 1.2.3
gem install win32console -v 1.3.0

Create file ~/.autotest
require 'autotest/growl' # enable pop-up windows
require 'autotest/restart' # optional: forces autotest to pick the changes to this file
require 'autotest/timestamp' # optional: shows timestamps for test runs

# filter out VCS files and other garbage to reduce HDD usage
Autotest.add_hook :initialize do |autotest|
  %w{.git .svn .hg .DS_Store ._* vendor tmp log doc}.each do |exception|
    autotest.add_exception(exception)
  end
end

# do not clear console before running tests
Autotest::Growl::clear_terminal = false

Start Crowl (it also has option to automatically start at login).

Start autotest:
autotest

Or for rspec integration:
autospec

Just reminder how to run your specs manually in rails folder:
spec spec

Things that I failed to use successfully:
redgreen gem (uses PLATFORM contant from unknown source)
snarl + ruby-snarl gem + test_notifier gem (it just does not shows pop-up windows)
fsevent gem (MAC only)

More reading:

http://www.railstutorial.org/chapters/static-pages#sec:first_tests

http://github.com/svoop/autotest-growl
    

Comments

Hoorure Net replied on Wed, 2008/01/09 - 2:45pm

Nice! I'm gonna try this

Alexey Tarasevich replied on Wed, 2010/01/06 - 7:52pm

i hope it helped