Rails3 Tutorial: autotest error
I'm reading 'Ruby on Rails3 Tutorial' and autotest was working fine for me. Then I updated some gems in my gemfile (after creating the User model at the beginning of Chapter 6, I double checked something in the online version of the book, and I noticed more recent gem versions specified in the Gemfile). Now autotest won't work at all--it just says it can't run any tests.
I changed all the gem versions back to the versions I originally specified in the Gemfile (i.e. the ones specified in the print book), but I can't get autotest to work anymore. Here is the error I am getting:
$ autotest
loading autotest/rails_rspec2
--------------------------------------------------------------------------------
/Users/Me/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -rrubygems -S /Users/Me/.rvm/gems/ruby- 1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/bin/rspec --tty '/Users/Me/rails_projects/sample_app/spec/controllers/pages_controller_spec.rb' '/Users/Me/rails_projects/sample_app/spec/controllers/users_controller_spec.rb' '/Users/Me/rails_projects/sample_app/spec/models/user_spec.rb' '/Users/Me/rails_projects/sample_app/spec/requests/layout_links_spec.rb'
Exception encountered: #<OptionParser::InvalidOption: --tty>
backtrace:
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.0.1/lib/rspec/core/option_parser.rb:18:in `parse!'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.0.1/lib/rspec/core/option_parser.rb:4:in `parse!'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.0.1/lib/rspec/core/configuration_options.rb:64:in `parse_command_line_options'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.0.1/lib/rspec/core/configuration_options.rb:46:in `parse_options'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.0.1/lib/rspec/core/command_line.rb:7:in `initialize'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.0.1/lib/rspec/monkey/spork/test_framework/rspec.rb:4:in `new'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.0.1/lib/rspec/monkey/spork/test_framework/rspec.rb:4:in `run_tests'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.8.4/lib/spork/run_strategy/forking.rb:13:in `block in run'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.8.4/lib/spork/forker.rb:21:in `block in initialize'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.8.4/lib/spork/forker.rb:18:in `fork'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.8.4/lib/spork/forker.rb:18:in `initialize'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.8.4/lib/spork/run_strategy/forking.rb:9:in `new'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.8.4/lib/spork/run_strategy/forking.rb:9:in `run'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.8.4/lib/spork/server.rb:47:in `run'
/Users/Me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1558:in `perform_without_block'
/Users/Me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1518:in `perform'
/Users/Me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1592:in `block (2 levels) in main_loop'
/Users/Me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1588:in `loop'
/Users/Me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1588:in `block in main_loop'
I stopped and restarted spork and rails server, but autotest still won't work for me.
This is the error I get with the newer gem versions in the Gemfile:
$ autotest
loading autotest/rails_rspec2
--------------------------------------------------------------------------------
/Users/Me/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -rrubygems -S /Users/Me/.rvm/gems/ruby- 1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/bin/rspec --tty '/Users/Me/rails_projects/sample_app/spec/controllers/pages_controller_spec.rb' '/Users/Me/rails_projects/sample_app/spec/controllers/users_controller_spec.rb' '/Users/Me/rails_projects/sample_app/spec/models/user_spec.rb' '/Users/Me/rails_projects/sample_app/spec/requests/layout_links_spec.rb'
Exception encountered: #<NameError: uninitialized constant PagesController>
backtrace:
/Users/Me/rails_projects/sample_app/spec/controllers/pages_controller_spec.rb:3:in `<top (required)>'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core- 2.6.4/lib/rspec/core/configuration.rb:419:in `block in load_spec_files'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `map'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load_spec_files'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:18:in `run'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/monkey/spork/test_framework/rspec.rb:5:in `run_tests'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.9.0.rc8/lib/spork/run_strategy/forking.rb:13:in `block in run'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.9.0.rc8/lib/spork/forker.rb:21:in `block in initialize'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.9.0.rc8/lib/spork/forker.rb:18:in `fork'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.9.0.rc8/lib/spork/forker.rb:18:in `initialize'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.9.0.rc8/lib/spork/run_strategy/forking.rb:9:in `new'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.9.0.rc8/lib/spork/run_strategy/forking.rb:9:in `run'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.9.0.rc8/lib/spork/server.rb:48:in `run'
/Users/Me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1558:in `perform_without_block'
/Users/Me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1518:in `perform'
/Users/Me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1592:in `block (2 levels) in main_loop'
/Users/Me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1588:in `loop'
/Users/Me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1588:in `block in main_loop'
Thanks for all the responses:
I'm not even sure where rspec-core-2.6.4 comes from(I do see it mentioned in the error message). The two 'rspec' versions I tried in my Gemfile are rspec 2.0.1 and rspec-rails 2.6.2. Following the suggestions, here is what I tried:
Gemfile (these are the original versions in the book, which used to work with autotest)
source 'http://rubygems.org'
gem 'rails', '3.0.9' #different in book
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
#***updated gem versions from online book****
#gem 'sqlite3', '1.3.3'
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
group :development do
#gem 'rspec-rails', '2.6.1'
gem 'rspec-rails', '2.0.1'
gem 'annotate', '2.4.0' #different in book
end
group :test do
#gem 'rspec-rails', '2.6.1'
gem 'rspec', '2.0.1'
gem 'webrat', '0.7.1'
#gem 'spork', '0.9.0.rc8'
gem 'spork', '0.8.4'
end
sample_app Me$ bundle install
Using rake (0.9.2)
Using abstract (1.0.0)
Using activesupport (3.0.9)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.9)
Using erubis (2.6.6)
Using rack (1.2.3)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.29)
Using actionpack (3.0.9)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.19)
Using actionmailer (3.0.9)
Using arel (2.0.10)
Using activerecord (3.0.9)
Using activeresource (3.0.9)
Using annotate (2.4.0)
Using bundler (1.0.15)
Using diff-lcs (1.1.2)
Using nokogiri (1.5.0)
Using rdoc (3.8)
Using thor (0.14.6)
Using railties (3.0.9)
Using rails (3.0.9)
Using rspec-core (2.0.1)
Using rspec-expectations (2.0.1)
Using rspec-mocks (2.0.1)
Using rspec (2.0.1)
Using rspec-rails (2.0.1)
Using spork (0.8.4)
Using sqlite3-ruby (1.2.5)
Using webrat (0.7.1)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
sample_app Me$ bundle update
Fetching source index for http://rubygems.org/
Using rake (0.9.2)
Using abstract (1.0.0)
Using activesupport (3.0.9)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.9)
Using erubis (2.6.6)
Using rack (1.2.3)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.29)
Using actionpack (3.0.9)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.19)
Using actionmailer (3.0.9)
Using arel (2.0.10)
Using activerecord (3.0.9)
Using activeresource (3.0.9)
Using annotate (2.4.0)
Using bundler (1.0.15)
Using diff-lcs (1.1.2)
Using nokogiri (1.5.0)
Using rdoc (3.8)
Using thor (0.14.6)
Using railties (3.0.9)
Using rails (3.0.9)
Using rspec-core (2.0.1)
Using rspec-expectations (2.0.1)
Using rspec-mocks (2.0.1)
Using rspec (2.0.1)
Using rspec-rails (2.0.1)
Using spork (0.8.4)
Using sqlite3-ruby (1.2.5)
Using webrat (0.7.1)
Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is installed.
sample_app Me$ bundle show spork
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.8.4
sample_app Me$ bundle exec spork
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork- 0.9.0.rc8/lib/spork/test_framework/cucumber.rb:2: warning: already initialized constant DEFAULT_PORT
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork- 0.9.0.rc8/lib/spork/test_framework/cucumber.rb:3: warning: already initialized constant HELPER_FILE
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.9.0.rc8/lib/spork/test_framework/rspec.rb:2: warning: already initialized constant DEFAULT_PORT
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.9.0.rc8/lib/spork/test_framework/rspec.rb:3: warning: already initialized constant HELPER_FILE
Using RSpec
Loading Spork.prefork block...
Spork is ready and listening on 8989!
But I when I open a new Terminal window and do:
sample_app Me$ autotest
I get the same --tty error. The command:
sample_app Me$ bundle exec autotest
throws a Gem::LoadError, and I don't think it should work since autotest is not in my Gemfile.
I get a different error when I use the Gemfile with the updated gem versions:
source 'http://rubygems.org'
gem 'rails', '3.0.9'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
#***updated gem versions from online book****
gem 'sqlite3', '1.3.3'
#gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
group :development do
gem 'rspec-rails', '2.6.1'
#gem 'rspec-rails', '2.0.1'
gem 'annotate', '2.4.0'
end
group :test do
gem 'rspec-rails', '2.6.1'
#gem 'rspec', '2.0.1'
gem 'webrat', '0.7.1'
gem 'spork', '0.9.0.rc8'
#gem 'spork', '0.8.4'
end
sample_app Me$ bundle install
Using rake (0.9.2)
Using abstract (1.0.0)
Using activesupport (3.0.9)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.9)
Using erubis (2.6.6)
Using rack (1.2.3)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.29)
Using actionpack (3.0.9)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.19)
Using actionmailer (3.0.9)
Using arel (2.0.10)
Using activerecord (3.0.9)
Using activeresource (3.0.9)
Using annotate (2.4.0)
Using bundler (1.0.15)
Using diff-lcs (1.1.2)
Using nokogiri (1.5.0)
Using rdoc (3.8)
Using thor (0.14.6)
Using railties (3.0.9)
Using rails (3.0.9)
Using rspec-core (2.6.4)
Using rspec-expectations (2.6.0)
Using rspec-mocks (2.6.0)
Using rspec (2.6.0)
Using rspec-rails (2.6.1)
Using spork (0.9.0.rc8)
Using sqlite3 (1.3.3)
Using webrat (0.7.1)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
--
sample_app Me$ bundle update
Fetching source index for http://rubygems.org/
Using rake (0.9.2)
Using abstract (1.0.0)
Using activesupport (3.0.9)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.9)
Using erubis (2.6.6)
Using rack (1.2.3)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.29)
Using actionpack (3.0.9)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.19)
Using actionmailer (3.0.9)
Using arel (2.0.10)
Using activerecord (3.0.9)
Using activeresource (3.0.9)
Using annotate (2.4.0)
Using bundler (1.0.15)
Using diff-lcs (1.1.2)
Using nokogiri (1.5.0)
Using rdoc (3.8)
Using thor (0.14.6)
Using railties (3.0.9)
Using rails (3.0.9)
Using rspec-core (2.6.4)
Using rspec-expectations (2.6.0)
Using rspec-mocks (2.6.0)
Using rspec (2.6.0)
Using rspec-rails (2.6.1)
Using spork (0.9.0.rc8)
Using sqlite3 (1.3.3)
Using webrat (0.7.1)
Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is installed.
sample_app Me$ bundle show spork
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.9.0.rc8
sample_app Me$ bundle exec spork
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8989!
--
sample_app Me$ autotest
loading autotest/rails_rspec2
--------------------------------------------------------------------------------
/Users/Me/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -rrubygems -S /Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/bin/rspec --tty '/Users/Me/rails_projects/sample_app/spec/controllers/pages_controller_spec.rb' '/Users/Me/rails_projects/sample_app/spec/controllers/users_controller_spec.rb' '/Users/Me/rails_projects/sample_app/spec/models/user_spec.rb' '/Users/Me/rails_projects/sample_app/spec/requests/layout_links_spec.rb'
Exception encountered: #<NameError: uninitialized constant PagesController>
backtrace:
/Users/Me/rails_projects/sample_app/spec/controllers/pages_controller_spec.rb:3:in `<top (required)>'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `block in load_spec_files'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `map'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load_spec_files'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:18:in `run'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/monkey/spork/test_framework/rspec.rb:5:in `run_tests'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.9.0.rc8/lib/spork/run_strategy/forking.rb:13:in `block in run'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.9.0.rc8/lib/spork/forker.rb:21:in `block in initialize'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.9.0.rc8/lib/spork/forker.rb:18:in `fork'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.9.0.rc8/lib/spork/forker.rb:18:in `initialize'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.9.0.rc8/lib/spork/run_strategy/forking.rb:9:in `new'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.9.0.rc8/lib/spork/run_strategy/forking.rb:9:in `run'
/Users/Me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.9.0.rc8/lib/spork/server.rb:48:in `run'
/Users/Me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1558:in `perform_without_block'
/Users/Me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1518:in `perform'
/Users/Me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1592:in `block (2 levels) in main_loop'
/Users/Me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1588:in `loop'
/Users/Me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1588:in `block in main_loop'
A开发者_如何学运维nd this appears in the spork window:
Running tests with args ["--color", "--tty", "/Users/Me/rails_projects/sample_app/spec/controllers/pages_controller_spec.rb", "/Users/Me/rails_projects/sample_app/spec/controllers/users_controller_spec.rb", "/Users/Me/rails_projects/sample_app/spec/models/user_spec.rb", "/Users/Me/rails_projects/sample_app/spec/requests/layout_links_spec.rb"]...
Done.
I got autotest working again by nuking the whole rails3tutorial gemset. The details for doing so are listed on p.90, Chapter 3.
1) After doing:
$ gem install rails
I started at the beginning of Chapter 3 using the Gemfile with the earlier gem versions(posted above). Followed by:
2) $ bundle install
3) $ rails generate rspec:install
4) Then I continued with the steps on p. 85, Chapter 3:
$ gem install autotest -v 4.3.2 (don't use sudo with rvm!)
$ gem install autotest
(Growl is already installed)
$gem install autotest-fsevent -v 0.2.2
$gem install autotest-growl -v 0.2.4
5) Then before doing:
$ spork --bootstrap
I copied and pasted spec/spec_helper.rb into a text editor, then I deleted spec/spec_helper.rb:
$ rm spec/spec_helper.rb
then:
$ spork --bootstrap
Then I copied and pasted the text in the text editor into the newly created spec/spec_helper.rb
6) $ bundle exec spork
7) Then I opened up a new Terminal window, and did:
$ autotest
Because I'm a masochist, I thought I would try updating the Gemfile again to the newer versions, and after doing a 'bundle install' and 'bundle update', I got the exact same PagesController error as before. And again, when I changed the gem versions back to the earlier versions in my Gemfile, and I did a 'bundle install' and 'bundle update', I got that -tty error. I'm going to nuke the rails3tutorial gemset again, and this time I will start with the newer versions in my Gemfile to see if that works.
I nuked the rails3tutorial gemset again, and this time I started with a Gemfile containing the newer gem versions listed in the online book, AND:
1) I installed the newer versions of the various autotest gems specified in the online version of the book.
AND
2) I modified the spec/spec_helper.rb file, which spork uses, according to the online version of the book. The online spec/spec_helper.rb file is different than the printed book's spec/spec_helper.rb file.
...and now autotest works again.
So switching to the new gem versions specified in the online book caused problems because the newer gem versions do not work with the printed book's spec/spec_helper.rb file, which I was using. However, that doesn't explain why after I changed my Gemfile to use the older gem versions again, I still got errors. As far as I can tell, there is a problem with using bundler to install different gem versions. Nuking the whole gemset solved the problem, but that is hardly a good solution.
(osx 10.6.7)
It looks like you're trying to run two different versions of RSpec (2.6.4 and 2.0.1). 2.6.4 is setting the -tty
option, which 2.0.1
doesn't recognize.
- Make sure you have run
bundle update
in your project directory. - Try running
bundle exec autotest
instead of justautotest
.
This could be a known issue with parallel_tests when used with rspec < 2.2 for the tty
option.
You have a couple of choices:
- Stop using the
tty
option if it is not vital to your operations, or.. - Upgrade to the latest version of rspec, where this option should be working.
This might help!
http://blog.chrisblunt.com/rails-configuring-rspec-for-spork/
He says: "The solution is to remove the condition from your spec_helper.rb:"
# spec/spec_helper.rb
# ...
# before:
# require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
require File.dirname(__FILE__) + "/../config/environment"
Worked for me!
In the book it had require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
in an unless?
conditional, by the way...
Make sure there's a pages_controller.rb in app/controllers/
In case you haven't figured it out, there is a better alternative to autotest, it's called infinity_test, check it out here, https://github.com/tomas-stefano/infinity_test .
I followed the instructions here, https://github.com/tomas-stefano/infinity_test/wiki/Customize-Infinity-Test , even modified it to fit my needs and it works like a charm.
I've went through the whole Rail 3 Tutorial twice, the Autotest thing worked for me the first time around but then when I update my gems it broke. I feel infinity_test is much easier to setup and has a lot more options.
I'm using Rails 3.0.9 and Rspec 2.5.0 on Ubuntu 10.10
Hope this helps!
精彩评论