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

前端之家收集整理的这篇文章主要介绍了ruby-on-rails-3 – RSpec 2:使用rspec-rails的’route_to’上的NoMethodError?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图运行这个测试…
  1. require 'spec_helper'
  2.  
  3. describe HomeController do
  4.  
  5. describe 'boilerplate routes' do
  6.  
  7. it "should route to '/about'" do
  8. { :get => "/about" }.should route_to(:controller => 'home',:action => 'show')
  9. end
  10.  
  11. end
  12.  
  13. end

…并且它一直失败与此错误消息:

  1. 1) HomeController boilerplate routes should route to '/about'
  2. Failure/Error: { :get => "/about" }.should route_to(:controller => 'home',:action => 'show')
  3. NoMethodError:
  4. undefined method `route_to' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x00000101499650>
  5. # ./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错过了.

猜你在找的Ruby相关文章