Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rspec问题,应包含内容_Ruby On Rails_Rspec - Fatal编程技术网

Ruby on rails Rspec问题,应包含内容

Ruby on rails Rspec问题,应包含内容,ruby-on-rails,rspec,Ruby On Rails,Rspec,我正在学习Hartl的Rails教程(第5节,清单5.17),当我运行Rspec时,总是会遇到一系列奇怪的意外错误。请注意,在本教程的这个阶段,页脚部分中的一个链接被有意注释掉,并且测试仍应通过本教程。如果我取消注释页脚部分中的链接,测试都会通过,但这对我来说没有任何意义。无论如何,以下是错误: rspec ./spec/requests/static_pages_spec.rb:17 # Static pages Home page should not have a custom page

我正在学习Hartl的Rails教程(第5节,清单5.17),当我运行Rspec时,总是会遇到一系列奇怪的意外错误。请注意,在本教程的这个阶段,页脚部分中的一个链接被有意注释掉,并且测试仍应通过本教程。如果我取消注释页脚部分中的链接,测试都会通过,但这对我来说没有任何意义。无论如何,以下是错误:

 rspec ./spec/requests/static_pages_spec.rb:17 # Static pages Home page should not have a custom page title
rspec ./spec/requests/static_pages_spec.rb:7 # Static pages Home page should have the content 'Sample App'
rspec ./spec/requests/static_pages_spec.rb:12 # Static pages Home page should have the title 'Home'
rspec ./spec/requests/static_pages_spec.rb:52 # Static pages Contact page should have the content 'Contact'
rspec ./spec/requests/static_pages_spec.rb:57 # Static pages Contact page should have the title 'Contact'
rspec ./spec/requests/static_pages_spec.rb:26 # Static pages Help page should have the content 'Help'
rspec ./spec/requests/static_pages_spec.rb:31 # Static pages Help page should have the title 'Help'
rspec ./spec/requests/static_pages_spec.rb:39 # Static pages About page should have the content 'About Us'
rspec ./spec/requests/static_pages_spec.rb:44 # Static pages About page should have the title 'About
这没有任何意义,因为当我查看每个页面的HTML时,内容/标题都清楚地显示在那里。但是,当我更仔细地查看日志时,我注意到页脚部分似乎始终存在错误

2) Static pages Home page should have the content 'Sample App'
     Failure/Error: visit '/static_pages/home'
     SyntaxError:
       /Users/anant/helpondemand/sample_app2/app/views/layouts/_footer.html.erb:10: syntax error, unexpected '<'
             <li> <a href="http://news.railstutorial.org/">News</a> </li>
              ^
       /Users/anant/helpondemand/sample_app2/app/views/layouts/_footer.html.erb:10: unknown regexp option - l
       /Users/anant/helpondemand/sample_app2/app/views/layouts/_footer.html.erb:11: syntax error, unexpected '<'
           </ul>
            ^
       /Users/anant/helpondemand/sample_app2/app/views/layouts/_footer.html.erb:12: unknown regexp options - av
       /Users/anant/helpondemand/sample_app2/app/views/layouts/_footer.html.erb:13: syntax error, unexpected '<'
       </footer>'.freeze;@output_buffer.to_s
        ^
       /Users/anant/helpondemand/sample_app2/app/views/layouts/_footer.html.erb:13: unterminated regexp meets end of file
     # ./app/views/layouts/application.html.erb:15:in `_app_views_layouts_application_html_erb___4305927437372856517_2202294640'
     # ./spec/requests/static_pages_spec.rb:8:in `block (3 levels) in <top (required)>'
2)静态页面主页应包含“示例应用”内容
失败/错误:访问“/静态页面/主页”
合成错误:
/Users/anant/helpondemand/sample_app2/app/views/layouts/_footer.html.erb:10:语法错误,意外“

footer class="footer">
  <small>
    <a href="http://railstutorial.org/">Rails Tutorial</a>
    by Michael Hartl
  </small>
  <nav>
    <ul>
      <li> <%= link_to "About",   '#' %> </li>
      <li> <%=# link_to "Contact", '#' %> </li>
      <li> <a href="http://news.railstutorial.org/">News</a> </li>
    </ul>
  </nav>
</footer>
<%# ... %>
   <li><%#= link_to "Contact", '#' %></li>