RSpec 2:“route_to”上出现 NoMethodError与 rspec-rails 一起?
我正在尝试运行此测试......
require 'spec_helper'
describe HomeController do
describe 'boilerplate routes' do
it "should route to '/about'" do
{ :get => "/about" }.should route_to(:controller => 'home', :action => 'show')
end
end
end
但它一直失败并显示以下错误消息:
1) HomeController boilerplate routes should route to '/about'
Failure/Error: { :get => "/about" }.should route_to(:controller => 'home', :action => 'show')
NoMethodError:
undefined method `route_to' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x00000101499650>
# ./spec/routes/home_routes_spec.rb:8:in `block (3 levels) in <top (required)>'
我正在使用 rspec-rails 2.5.0
和 rails 3.0.5
代码> & rspec 2.5.1。
I'm trying to run this test...
require 'spec_helper'
describe HomeController do
describe 'boilerplate routes' do
it "should route to '/about'" do
{ :get => "/about" }.should route_to(:controller => 'home', :action => 'show')
end
end
end
... and it keeps failing with this error message:
1) HomeController boilerplate routes should route to '/about'
Failure/Error: { :get => "/about" }.should route_to(:controller => 'home', :action => 'show')
NoMethodError:
undefined method `route_to' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x00000101499650>
# ./spec/routes/home_routes_spec.rb:8:in `block (3 levels) in <top (required)>'
I'm using rspec-rails 2.5.0
with rails 3.0.5
& rspec 2.5.1
.
I'm doing my code just like it says in the rdocs, trying to follow along with this example code... what am I doing wrong? Help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
阿芙,发现我的问题了。
我的路由规范文件夹名为
spec/routes
而不是spec/routing
,它应该是这样。在自述文件中错过了这一点。
Aph, found my problem.
I had my routing spec folder named
spec/routes
instead ofspec/routing
, which it should be.Missed that in the readme.