I am trying to get Rspec up and running but ran into the following issue when calling rspec spec
from the command line:
Failure/Error: Unable to find matching line from backtrace
undefined method `request=' for #<Name:0x000001033c1be0>
This seems to b开发者_如何学Goe an issue with a combination of certain gems but I cannot figure out what´s wrong with my setup:
Here it is:
rails -v
Rails 3.0.9
ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0]
rvm -v
rvm 1.6.2
My Gemfile looks like this (I skip irrelevant gems):
group :development, :test do
gem 'factory_girl_rails'
gem 'rspec-rails', '~> 2.6'
gem 'webrat'
end
Addition:
I added the following line to spec_helper.rb, in order to fix the error that is described here.
config.include RSpec::Rails::ControllerExampleGroup
Any hints?
In the meanwhile I solved the issue.
The above described issue occured when I set up my first controller test.
describe MyController do
describe "#index" do
it "responses successfully" do
get :index
response.should be_success
end
end
end
To get rid of the problem I had to move the above mentioned line from spec_helper directly into the ControllerSpec.
describe MyController do
include RSpec::Rails::ControllerExampleGroup
describe "#index" do
it "responses successfully" do
get :index
response.should be_success
end
end
end
Go back to work ;-)
精彩评论