ruby-on-rails-3 – RSpec 2:使用rspec-rails的’route_to’上
发布时间:2020-12-16 19:51:21 所属栏目:百科 来源:网络整理
导读:我试图运行这个测试… 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 endend …并且它一直失败与
我试图运行这个测试…
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错过了. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |