简体   繁体   English

Ruby 1.8.7中的Rspec错误

[英]Rspec errors in Ruby 1.8.7

I have been trying to do bundle exec rspec spec/requests/static_pages_spec.rb but everytime I try to do it I get these 9 errors: 我一直在尝试捆绑exec rspec spec / requests / static_pages_spec.rb,但是每次尝试这样做时,我都会得到以下9个错误:

no DRb server is running. Running in local process instead ...
FFFFFFFFF

Failures:

  1) Static pages Home page should have the h1 'Sample App'
     Failure/Error: visit root_path
     NameError:
       undefined local variable or method `root_path' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x1047a1cc8>
     # ./spec/requests/static_pages_spec.rb:8

  2) Static pages Home page should have the base title
     Failure/Error: visit root_path
     NameError:
       undefined local variable or method `root_path' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x1047858e8>
     # ./spec/requests/static_pages_spec.rb:13

  3) Static pages Home page should not have a custom page title
     Failure/Error: visit root_path
     NameError:
       undefined local variable or method `root_path' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x10477f448>
     # ./spec/requests/static_pages_spec.rb:18

  4) Static pages Help page should have the h1 'Help'
     Failure/Error: visit help_path
     ActionView::Template::Error:
       undefined method `full_title' for #<#<Class:0x1069a3e98>:0x1069a0bf8>
     # ./app/views/layouts/application.html.erb:4:in `_app_views_layouts_application_html_erb___963741010_2202798760'
     # ./spec/requests/static_pages_spec.rb:26

  5) Static pages Help page should have the title 'Help'
     Failure/Error: visit help_path
     ActionView::Template::Error:
       undefined method `full_title' for #<#<Class:0x1069a3e98>:0x10692e508>
     # ./app/views/layouts/application.html.erb:4:in `_app_views_layouts_application_html_erb___963741010_2202798760'
     # ./spec/requests/static_pages_spec.rb:31

  6) Static pages About page should have the h1 'About Us'
     Failure/Error: visit about_path
     ActionView::Template::Error:
       undefined method `full_title' for #<#<Class:0x1069a3e98>:0x1068fb928>
     # ./app/views/layouts/application.html.erb:4:in `_app_views_layouts_application_html_erb___963741010_2202798760'
     # ./spec/requests/static_pages_spec.rb:39

  7) Static pages About page should have the title 'About Us'
     Failure/Error: visit about_path
     ActionView::Template::Error:
       undefined method `full_title' for #<#<Class:0x1069a3e98>:0x1068bc3e0>
     # ./app/views/layouts/application.html.erb:4:in `_app_views_layouts_application_html_erb___963741010_2202798760'
     # ./spec/requests/static_pages_spec.rb:44

  8) Static pages Contact page should have the content 'Contact'
     Failure/Error: visit contact_path
     ActionView::Template::Error:
       undefined method `full_title' for #<#<Class:0x1069a3e98>:0x106b095a8>
     # ./app/views/layouts/application.html.erb:4:in `_app_views_layouts_application_html_erb___963741010_2202798760'
     # ./spec/requests/static_pages_spec.rb:52

  9) Static pages Contact page should have the title 'Contact'
     Failure/Error: visit contact_path
     ActionView::Template::Error:
       undefined method `full_title' for #<#<Class:0x1069a3e98>:0x106abb740>
     # ./app/views/layouts/application.html.erb:4:in `_app_views_layouts_application_html_erb___963741010_2202798760'
     # ./spec/requests/static_pages_spec.rb:57

I have restarted the spork server and removed the public/index.html file and I still get the errors. 我已经重新启动了spork服务器并删除了public / index.html文件,但仍然出现错误。 Here are the results of my rake routes: 这是我耙路的结果:

static_pages_home     /static_pages/home(.:format)    static_pages#home
                help GET /help(.:format)                 static_pages#help
               about GET /about(.:format)                static_pages#about
             contact GET /contact(.:format)              static_pages#contact
                     GET /static_pages/home(.:format)    static_pages#home
   static_pages_help GET /static_pages/help(.:format)    static_pages#help
  static_pages_about GET /static_pages/about(.:format)   static_pages#about
static_pages_contact GET /static_pages/contact(.:format) static_pages#contact

The root_path errors are because you don't have a "root" route defined. root_path错误是因为您没有定义“ root”路由。 You would need to share your code to analyze the reason for the full_title not being defined. 您将需要共享代码以分析full_title的原因。 If you're following Hartl's tutorial, you might want to add a tag for that. 如果您正在遵循Hartl的教程,则可能要为此添加一个标签。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM