How do I get autotest to work?

For the life of me, I can’t get autotest to work. I should note that
I am not using RVM, because I couldn’t get it to work. I’m doing my
development in VirtualBox so I can seamlessly switch from one setup to
another.

I’m going through chapter 3 at railstutorial.org (http://
ruby.railstutorial.org/chapters/static-pages#sec:first_tests), and I
can’t get autotest to work.

As the instructions say, I gem installed autotest -v 4.4.6, autotest-
rails-pure -v 4.1.2, ZenTest, and redgreen and git removed spec/views
and spec/helpers. I used apt-get to install libnotify-bin.

I created the ~/.autotest file and downloaded the images to
~/.autotest_images as instructed at
http://automate-everything.com/2009/08/gnome-and-autospec-notifications/
.

But no matter what I do, entering “bundle exec rspec spec/” gives me a
LONG error message:
/home/jhsu/rails_projects/sample_app/spec/controllers/
pages_controller_spec.rb:1:in require': no such file to load -- spec_helper (LoadError) from /home/jhsu/rails_projects/sample_app/spec/controllers/ pages_controller_spec.rb:1:in <top (required)>’
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/
configuration.rb:419:in load' from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/ configuration.rb:419:in block in load_spec_files’
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/
configuration.rb:419:in map' from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/ configuration.rb:419:in load_spec_files’
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/
command_line.rb:18:in run' from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/ runner.rb:80:in run_in_process’
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/
runner.rb:69:in run' from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/ runner.rb:11:in block in autorun’

CONTENTS OF pages_controller_spec.rb:
require ‘spec_helper’

describe PagesController do

describe “GET ‘home’” do
it “should be successful” do
get ‘home’
response.should be_success
end
end

describe “GET ‘contact’” do
it “should be successful” do
get ‘contact’
response.should be_success
end
end

end

The command “gem list --local” gives me:
abstract (1.0.0)
actionmailer (3.1.2, 3.0.11)
actionpack (3.1.2, 3.0.11)
activemodel (3.1.2, 3.0.11)
activerecord (3.1.2, 3.0.11)
activeresource (3.1.2, 3.0.11)
activesupport (3.1.2, 3.0.11)
addressable (2.2.6)
arel (2.2.1, 2.0.10)
autotest (4.4.6)
autotest-rails-pure (4.1.2)
builder (3.0.0, 2.1.2)
bundler (1.0.21)
diff-lcs (1.1.3)
erubis (2.7.0, 2.6.6)
heroku (2.14.0)
hike (1.2.1)
i18n (0.6.0, 0.5.0)
json (1.6.1)
launchy (2.0.5)
mail (2.3.0, 2.2.19)
mime-types (1.17.2)
multi_json (1.0.3)
nokogiri (1.5.0)
polyglot (0.3.3)
rack (1.3.5, 1.2.4)
rack-cache (1.1)
rack-mount (0.8.3, 0.6.14)
rack-ssl (1.3.2)
rack-test (0.6.1, 0.5.7)
rails (3.0.11)
railties (3.1.2, 3.0.11)
rake (0.9.2.2)
rdoc (3.11)
redgreen (1.2.2)
rest-client (1.6.7)
rspec (2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
rspec-mocks (2.6.0)
rspec-rails (2.6.1)
rubyzip (0.9.4)
sprockets (2.1.1)
sqlite3 (1.3.4, 1.3.3)
term-ansicolor (1.0.7)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)
webrat (0.7.1)
ZenTest (4.6.2)

check this out!–>

On Sun, Nov 27, 2011 at 11:56 PM, Jason H., Mr. Swift L. <

Am 27.11.2011 19:26, schrieb Jason H., Mr. Swift L.:

For the life of me, I can’t get autotest to work. I should note that
I am not using RVM, because I couldn’t get it to work. I’m doing my
development in VirtualBox so I can seamlessly switch from one setup to
another.

Not really an answer to your question, but did you thought about using
guard to get similar behaviour? Additionaly you could use guard-rails to
automatically restart the server when ever it is needed.

You can get guard itself from github:
https://github.com/guard/guard

Also there is a growing list of guardscripts:
https://github.com/guard/guard/wiki/List-of-available-Guards

A list of scripts I often use:
guard-rails:
https://github.com/guard/guard/wiki/List-of-available-Guards
guard-rspec:
https://github.com/guard/guard-rspec
guard-cucumber:
https://github.com/guard/guard-cucumber

But probably you’ll find your own combination of scripts in the list
above?

Only thing I miss, would be conditional running of other guards.
Actually it restarts the server if corresponding files where changed,
independent from the outcome of guard-cucumber and guard-rspec.

Bye
Norbert

Do you have spec/spec_helper.rb?

On Nov 27, 1:26pm, “Jason H., Mr. Swift L.”