可能重复:
Rails pages_controller_spec.rb test shouldn't be failing but is, error?
Rails 3.0,遵循Michael Hartl的Ruby on Rails教程 怎么可能得到"没有路线匹配{:contoller =>"页面",:action =>" help}? 我更简单地提出的问题是"为什么我的rspec规范/测试失败?"
$ bundle exec rspec spec/
ActionController::RoutingError:
No route matches {:controller=>"pages", :action=>"help"}
# ./spec/controllers/pages_controller_spec.rb:49:in `block (3 levels) in <top (required)>'
跑步时我明显有
所示的路线$ rake routes
pages_home GET /pages/home(.:format) {:controller=>"pages", :action=>"home"}
pages_contact GET /pages/contact(.:format) {:controller=>"pages", :action=>"contact"}
pages_about GET /pages/about(.:format) {:controller=>"pages", :action=>"about"}
pages_help GET /pages/help(.:format) {:controller=>"pages", :action=>"help"}
它每次都给我一个失败的测试,尽管当我运行一个rails服务器时我在localhost:3000 / pages / help有正确的页面。据我所知,一切都在正确的顺序: Rails pages_controller_spec.rb test shouldn't be failing but is, error?