Ruby on rails 路由错误没有与之匹配的路由{:操作=>;/";,:控制器=>;";静态页面}

Ruby on rails 路由错误没有与之匹配的路由{:操作=>;/";,:控制器=>;";静态页面},ruby-on-rails,ruby,routing,rails-routing,Ruby On Rails,Ruby,Routing,Rails Routing,我是一个ROR新手,正在学习Micheal Hartl的教程。我已经完成了教程的每一个步骤,我被关于路线的错误所困扰。我已经检查了我所有的代码,并尝试了谷歌的所有解决方案。长话短说,我想通过考试 这是我的路线 Rails.application.routes.draw do root 'static_pages#home' get '/help', to: 'static_pages#help' end` 下面是错误描述 1) 错误StaticPagesControllerTest#test应

我是一个ROR新手,正在学习Micheal Hartl的教程。我已经完成了教程的每一个步骤,我被关于路线的错误所困扰。我已经检查了我所有的代码,并尝试了谷歌的所有解决方案。长话短说,我想通过考试

这是我的路线

Rails.application.routes.draw do
root 'static_pages#home'
get '/help', to: 'static_pages#help'
end`
下面是错误描述

1) 错误
StaticPagesControllerTest#test应返回主页: ActionController::UrlGenerationError:没有路由匹配{:action=>“/”,:controller=>“static_pages”}test/controllers/static_pages_controller_test.rb:10:类中的块中:StaticPagesControllerTest'
2)错误
StaticPagesControllerTest#test(测试)应获得帮助: ActionController::UrlGenerationError:没有路由匹配{:action=>“/help”,:controller=>“static_pages”} test/controllers/static\u pages\u controller\u test.rb:16:in`block in class:StaticPagesControllerTest'

这是我的耙路线的样子


根目录获取/静态页面#主页
帮助获取/帮助(:格式)静态页面#帮助
关于获取/关于(:格式)静态页面#关于
联系人获取/联系人(:格式)静态页面#联系人

我试过了

root 'static_pages#home'
get '/static_pages/help', to: 'static_pages#help'

但我仍然无法解决这个问题。我已经盯着这个代码和错误好几天了。请帮忙

*编辑以包含测试

test "should get home" do
  get root_path
  assert_response :success
  assert_select "title", "Home | #{@base_title}"
end

test "should get help" do
  get help_path
  assert_response :success
  assert_select "title", "Help | #{@base_title}"
end

轨道-V4.1.10;ruby-v2.1.5p273第一个错误是
{:action=>“/”,:controller=>“static_pages”}
。请注意,操作(即控制器中定义的方法)是
/
。您的操作似乎被命名为
home
help
。如果您发布您的测试,我们将能够告诉您更多信息。您可以转到测试之外的路线吗?如果转到localhost:3000,是否会出现错误或显示页面?页面工作正常,唯一的问题是测试失败请在终端窗口中运行
rake routes
,并将输出添加到问题中。
test "should get home" do
  get root_path
  assert_response :success
  assert_select "title", "Home | #{@base_title}"
end

test "should get help" do
  get help_path
  assert_response :success
  assert_select "title", "Help | #{@base_title}"
end