ruby-on-rails-3 – RSpec 2:使用rspec-rails的’route_to’上的NoMethodError?

我试图运行这个测试…
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.

我正在做我的代码,就像rdocs中所说的,试图跟着this example code …我做错了什么?帮帮我!

解决方法

呃,发现我的问题.

我的路由规范文件夹命名为spec / routes,而不是spec / routing,它应该是.

readme错过了.

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...