尝试让我的标题测试通过并在运行时看到此错误:
bundle exec rspec spec/requests/static_pages_spec.rb
故障:
1) Static pages Help page should have the h1 'Help'
Failure/Error: visit '/static_pages/Help'
ActionController::RoutingError:
No route matches [GET] "/static_pages/Help"
# ./spec/requests/static_pages_spec.rb:19:in `block (3 levels) in <top (required)>'
2) Static pages Help page should have the title 'Help'
Failure/Error: visit '/static_pages/Help'
ActionController::RoutingError:
No route matches [GET] "/static_pages/Help"
# ./spec/requests/static_pages_spec.rb:24:in `block (3 levels) in <top (required)>'
3) Static pages About page should have the h1 'About Us'
Failure/Error: visit '/static_pages/About'
ActionController::RoutingError:
No route matches [GET] "/static_pages/About"
# ./spec/requests/static_pages_spec.rb:31:in `block (3 levels) in <top (required)>'
4) Static pages About page should have the title 'About Us'
Failure/Error: visit '/static_pages/About'
ActionController::RoutingError:
No route matches [GET] "/static_pages/About"
# ./spec/requests/static_pages_spec.rb:36:in `block (3 levels) in <top (required)>'
Finished in 0.16042 seconds
6 examples, 4 failures
Failed examples:
rspec ./spec/requests/static_pages_spec.rb:18 # Static pages Help page should have the h1 'Help'
rspec ./spec/requests/static_pages_spec.rb:23 # Static pages Help page should have the title 'Help'
rspec ./spec/requests/static_pages_spec.rb:30 # Static pages About page should have the h1 'About Us'
rspec ./spec/requests/static_pages_spec.rb:35 # Static pages About page should have the title 'About Us'
SampleApp :: Application.routes.draw做
get "static_pages/home"
get "static_pages/help"
get "static_pages/about"
我已尝试在其他帖子中发布的各种答案但未成功。任何帮助将非常感激。
答案 0 :(得分:1)
您的网址应为'/ static_pages / help'而非'/ static_pages / Help'。