Ruby on rails 预期css“;标题「;加上“文字”“帮助”;不归还任何东西
我正在阅读MichaelHartl的RubyonRails教程,遇到了这个问题。我得到的是下面的错误,而不是通常的rspec错误 静态页面,帮助页面Ruby on rails 预期css“;标题「;加上“文字”“帮助”;不归还任何东西,ruby-on-rails,ruby,rspec,Ruby On Rails,Ruby,Rspec,我正在阅读MichaelHartl的RubyonRails教程,遇到了这个问题。我得到的是下面的错误,而不是通常的rspec错误 静态页面,帮助页面 Failure/Error: it { should_not have_selector 'title', text: "| Help" } expected css "title" with text "| Help" not to return anything # ./spec/requests/static_pages_spec.
Failure/Error: it { should_not have_selector 'title', text: "| Help" }
expected css "title" with text "| Help" not to return anything
# ./spec/requests/static_pages_spec.rb:27:in `block (3 levels) in <top (required)>'
home.html.erb
<% provide(:title, 'Help') %>
<h1>Help</h1>
<p>This is the Help page</p>
帮助
这是帮助页面
application.html.erb
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
</head>
<body>
<%= render 'layouts/header' %>
<div class="container">
<%= yield %>
<%= render 'layouts/footer' %>
</div>
</body>
</html>
“全部”%>
TITLE元素应该出现在文档的头部。我已经添加了application.html.erb。标题实际上位于文档的开头部分
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
</head>
<body>
<%= render 'layouts/header' %>
<div class="container">
<%= yield %>
<%= render 'layouts/footer' %>
</div>
</body>
</html>