Rails Forum
Rails Work - the best place to post and find great Ruby on Rails jobs.
Username
Password

You are not logged in.

New Posts in this thread
  • Index
  •  » Tutorials
  •  » Using Autotest with Rails on Windows XP machines

#1 2006-10-24 08:28:34

daibatzu
Coach Class
Registered: 2006-06-23
Posts: 63

Using Autotest with Rails on Windows XP machines

This is a short tutorial on how to use autotest on a Windows XP device. The great thing about autotest is that it updates your test results automatically each time you make changes to your models, controllers or test files. Here's how to do it.

First, install ZenTest


Code :   - fold - unfold
  1. gem install ZenTest
Then go to the directory of your rails application. For example:


Code :   - fold - unfold
  1. cd c:\rails\myrailsapp
Next, before you start autotest, you should always set the env variable. At least on Windows. You do it like so


Code :   - fold - unfold
  1. set HOME = C:\Documents and Settings\username
Note that username is your name on your machine. It could be daibatzu or john, lisa, mark whatever. So for john it would be "set HOME = C:\Documents and Settings\john". If you are in doubt, just click on the start button and you should see the name of the current user at the very top of the start menu next to your avatar when logged in.

After this, assuming you are still in the directory of your rails app, simply type the command.


Code :   - fold - unfold
  1. autotest --rails
And voila, autotesting is enabled. This is actually a very cool tool as you will soon find out. Simply begin writing tests for your rails applications and see what happens.

Offline

 

#2 2008-01-08 17:29:40

eggman2001
Ticketholder
Registered: 2008-01-08
Posts: 2

Re: Using Autotest with Rails on Windows XP machines

I just want to mention that to get the env variable to work, I added it in My Computer>Properties and then had to restart my computer.
http://groups.google.com/group/rubyonra … nvironment

Offline

 

#3 2008-01-08 19:41:16

adish
Ticketholder
Registered: 2007-12-19
Posts: 5
Website

Re: Using Autotest with Rails on Windows XP machines

Actually, you also need diff.exe in your path.
See my rant and tutorial here: http://rookieonrails.blogspot.com/2007/ … ndows.html

Offline

 

#4 2008-01-12 23:43:09

sambo99
Ticketholder
Registered: 2008-01-04
Posts: 17
Website

Re: Using Autotest with Rails on Windows XP machines

Has anyone seen this error on windows?

c:/ruby/bin/unit_diff:19: invalid name for global variable - -u; (NameError)

Offline

 

#5 2008-01-15 15:09:25

tick
Ticketholder
Registered: 2008-01-13
Posts: 4

Re: Using Autotest with Rails on Windows XP machines

I needed to delete --colour in the spec.opts to make it actually work.

Offline

 

#6 2008-01-22 05:35:20

AdamFortuna
Ticketholder
Registered: 2007-11-04
Posts: 7

Re: Using Autotest with Rails on Windows XP machines

I was getting the following error after following this:

C:/Program Files/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:377:in `report_activate_error': RubyGem version error: hoe(1.3.0 not >= 1.4.0) (Gem::LoadError)
        from C:/Program Files/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:309:in `activate'
        from C:/Program Files/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:335:in `activate'
        from C:/Program Files/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:334:in `each'
        from C:/Program Files/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:334:in `activate'
        from C:/Program Files/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:76:in `active_gem_with_options'
        from C:/Program Files/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:50:in `gem'
        from C:/Program Files/ruby/bin/autotest:18

Turns out I had to run a "gem update --include-dependencies" before this would work for me.

Offline

 
  • Index
  •  » Tutorials
  •  » Using Autotest with Rails on Windows XP machines

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson