RSpec error while following http://ruby.railstutorial.org/ tutorial
I've searched everywhere but I can't seem to find a solution. I have been following the tutorial on http://ruby.railstutorial.org/ and I'm on Chapter 3 trying to execute a test using "rspec spec/"
However I keep recieving the following error:
Failure/Error: Unable to find matching line from backtrace
NameError:
uninitialized constant ActionController::TestCase::Assertions
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/backward_compatibility.rb:20:in `const_missing'
# /var/lib/gems/1.8/gems/rspec-expectations-2.5.0/lib/rspec/expectations/backward_compatibility.rb:6:in `const_missing'
# /usr/lib/ruby/1.8/action_controller/integration.rb:18
# /var/lib/gems/1.8/gems/webrat-0.7.1/lib/webrat/integrations/rails.rb:2
# /var/lib/gems/1.8/gems/webrat-0.7.1/lib/webrat/core/configuration.rb:105:in `mode='
# /var/lib/gems/1.8/gems/rspec-rails-2.5.0/lib/rspec/rails/example/controller_example_group.rb:172
# /var/lib/gems/1.8/gems/webrat-0.7.1/lib/webrat/core/configuration.rb:9:in `configure'
# /var/lib/gems/1.8/gems/rspec-rails-2.5.0/lib/rspec/rails/example/controller_example_group.rb:172
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/hooks.rb:29:in `instance_eval'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/hooks.rb:29:in `run_in'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/hooks.rb:64:in `run_all'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/hooks.rb:64:in `each'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/hooks.rb:64:in `run_all'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/hooks.rb:110:in `run_hook'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:191:in `eval_before_eachs'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:191:in `each'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:191:in `eval_before_eachs'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:144:in `run_before_each'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:48:in `run'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:106:in `with_around_hooks'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:46:in `run'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:99:in `with_pending_capture'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:98:in `catch'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:98:in `with_pending_capture'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:45:in `run'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:262:in `run_examples'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:258:in `map'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:258:in `run_examples'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:232:in `run'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:233:in `run'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:233:in `map'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:233:in `run'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:27:in `run'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:27:in `map'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:27:in `run'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/reporter.rb:12:in `report'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspe开发者_Go百科c/core/command_line.rb:24:in `run'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:55:in `run_in_process'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:46:in `run'
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:10:in `autorun'
# /var/lib/gems/1.8/bin/rspec:19
I've attempted to uninstall and reinstall gems with no luck.
Here is my gem list:
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.4, 3.0.3)
actionpack (3.0.4, 3.0.3)
activemodel (3.0.4, 3.0.3)
activerecord (3.0.4, 3.0.3)
activerecord-oracle_enhanced-adapter (1.3.2, 1.3.1)
activeresource (3.0.4, 3.0.3)
activesupport (3.0.4, 3.0.3)
arel (2.0.8, 2.0.7)
autotest (4.4.6)
autotest-rails-pure (4.1.2)
builder (3.0.0, 2.1.2)
bundler (1.0.10)
cgi_multipart_eof_fix (2.5.0)
daemon_controller (0.2.6, 0.2.5)
diff-lcs (1.1.2)
erubis (2.6.6)
fastthread (1.0.7)
file-tail (1.0.5)
gem_plugin (0.2.3)
i18n (0.5.0)
mail (2.2.15, 2.2.14)
mime-types (1.16)
nifty-generators (0.4.5, 0.4.4)
nokogiri (1.4.4)
passenger (3.0.2)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
rack-test (0.5.7)
rails (3.0.4, 3.0.3)
railties (3.0.4, 3.0.3)
rake (0.8.7)
redgreen (1.2.2)
rspec (2.3.0)
rspec-core (2.3.1)
rspec-expectations (2.3.0)
rspec-mocks (2.3.0)
rspec-rails (2.3.0)
ruby-oci8 (2.0.4)
spruz (0.2.5)
sqlite3 (1.3.3)
sqlite3-ruby (1.3.3, 1.3.2)
sys-uname (0.8.5)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.24)
webrat (0.7.3, 0.7.1)
ZenTest (4.4.2)
Gem File
source 'http://rubygems.org'
gem 'rails', '3.0.4'
gem 'sqlite3-ruby', '1.3.2', :require => 'sqlite3'
group :development do
gem 'rspec-rails', '2.5.0'
end
group :test do
gem 'rspec', '2.5.0'
gem 'webrat', '0.7.1'
end
I found a similar solution to m.galkiewicz. I am on ubuntu 10.10. I identified this issue because of the following line from your error: # /usr/lib/ruby/1.8/action_controller/integration.rb:18
When I compared to my friends working install on the same version of ubuntu, action_controller was not within the /usr/lib/ruby/1.8 path.
I found that I had installed rails and rake via apt-get, not via rubygems. Here are the modifications I made to get it going:
- sudo apt-get remove rails
- sudo gem install rails
- sudo bundle install
I was then able to run rspec and continue with the tutorial.
I managed to get this working by removing rails from apt-get (as previously recommended by others) and installing from rubygems, but that was not enough. It was necessary to then run 'apt-get autoremove'. Now all is well.
I'm going through this book too and am documenting how it's going www.ridingrails.co.uk might help. My Gemfile looks like
source 'http://rubygems.org'
gem 'rails', '3.0.11'
gem 'sqlite3', '1.3.3'
gem 'heroku'
gem 'spork', '0.9.0.rc8'
gem 'gravatar_image_tag', '0.1.0'
group :development do
gem 'rspec-rails', '2.6.1'
gem 'annotate'
end
group :test do
gem 'rspec-rails', '2.6.1'
gem 'webrat', '0.7.1'
gem 'factory_girl_rails'
end
but took me a bit of time to get everything up and running. I'd take a look at the book use the gems that are there.
Try to upgrade rspec to 2.5.0
You should have then:
rspec (2.5.0)
rspec-core (2.5.1)
rspec-expectations (2.5.0)
rspec-mocks (2.5.0)
rspec-rails (2.5.0)
And remove webrat 0.7.1, just keep 0.7.3
webrat (0.7.3)
I had the same problem on debian squeeze. Make sure that rails and other ruby related packages are installed from rubygems and not your distro's repository.
ii libruby 4.5
ii libruby1.8 1.8.7.302-2
ii libruby1.9.1 1.9.2.0-2
ii libxml-ruby1.8 1.1.3-2
ii libxslt-ruby 0.9.2-5
ii libxslt-ruby1.8 0.9.2-5
ii ruby 4.5
ii ruby-dev 4.5
ii ruby1.8 1.8.7.302-2
ii ruby1.8-dev 1.8.7.302-2
ii ruby1.9.1 1.9.2.0-2
ii rubygems 1.3.7-3
ii rubygems1.8 1.3.7-3
We had this problem. We looked at the backtrace, which was:
16) DesktopsController DELETE destroy redirects to the desktops list
Failure/Error: Unable to find matching line from backtrace
NameError:
uninitialized constant ActionController::TestCase::Assertions
# /var/lib/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/backward_compatibility.rb:20:in `const_missing'
# /var/lib/gems/1.8/gems/rspec-expectations-2.5.0/lib/rspec/expectations/backward_compatibility.rb:6:in `const_missing'
# /usr/lib/ruby/1.8/action_controller/integration.rb:18
# /var/lib/gems/1.8/gems/webrat-0.7.3/lib/webrat/integrations/rails.rb:2
noticing that this was requiring dpkg'ed rails from webrat, we looked at integration/rails.rb. We see that it was including action_controller/integration.rb. Looking at our action_controller 3.0.4, we see that this does not exist anymore. Of course, removing the dpkg installed ones may change this problem, but really it is an API incompatibility between webrat 0.7.3 and action_controller 3.0.4. I do not see a newer version of webrat, so we will live with this manual patch, since we need it only for testing, not in production.
精彩评论