Reputation: 935
I am working on a sample RoR app and I am having trouble testing it with rspec. I have rspec installed and running the tests however they are failing and I don't know why. I run the command:
bundle exec rspec spec/
And when I run this; this is the error message I get:
Failures:
1) PagesController GET 'home' should be successful
Failure/Error: Unable to find matching line from backtrace
NameError:
uninitialized constant ActionController::TestCase::Assertions
# /usr/lib/ruby/vendor_ruby/action_controller/integration.rb:18
# /usr/lib/ruby/gems/1.8/gems/webrat-0.7.1/lib/webrat/integrations/rails.rb:2
# /usr/lib/ruby/gems/1.8/gems/webrat-0.7.1/lib/webrat/core/configuration.rb:105:in `mode='
# /usr/lib/ruby/gems/1.8/gems/rspec-rails-2.6.1/lib/rspec/rails/vendor/webrat.rb:26
# /usr/lib/ruby/gems/1.8/gems/webrat-
And alot more error messages.
I'm no expert on RoR and would really appreciate help. Thanks in advance.
Upvotes: 1
Views: 1803
Reputation: 1567
I had the same problem on a fresh Ubuntu 11.10 install.
After ensuring I was using the latest versions of rspec and that rails was installed using
gem install rails
I also ensured that uninstalling the ubuntu rails didn't leave any artificts with
sudo apt-get autoremove
I also had ruby 1.8.7 so I switched to 1.9.2
rvm use 1.9.2
Either my ruby version was the problem or the autoremove removed some interference. But things were working after that.
Upvotes: 0
Reputation: 960
RSpec is only guaranteed to work out of the box for Rail defaults. Remove webrat from your Gemfile and try it again.
Depending on the tutorial this might break things again in later steps.
My solution to the problem was to remove the package installation of rails (apt-get remove rails && apt-get autoremove) and its dependencies, because it was apparently clashing with the gem install. Quite understandable. You can install it with gem (sudo gem install rails)
Upvotes: 1