Ruby on rails Rspec与标题不匹配
我有以下规格Ruby on rails Rspec与标题不匹配,ruby-on-rails,rspec,capybara,Ruby On Rails,Rspec,Capybara,我有以下规格 describe "user enters 150 into time" do before do fill_in "workout[total_time]", with: "150" click_button "Update Workout" end it "should be on profile page" do save_and_open_page page.should have_selector("h1", text: "Profil
describe "user enters 150 into time" do
before do
fill_in "workout[total_time]", with: "150"
click_button "Update Workout"
end
it "should be on profile page" do
save_and_open_page
page.should have_selector("h1", text: "Profile")
page.should have_selector("title", text: "Profile")
end
end
它失败,并显示以下消息:
Capybara::ExpectationNotMet: expected to find css "title" with text "Profile" but there were no matches. Also found "", which matched the selector but not all filters.
源代码(来自保存和打开页面
)包含此标题
部分:
<head>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>Profile
</title>
<meta content="Composer Delete" name="description">
<link href="/assets/application.css" media="all" rel="stylesheet" type="text/css">
<script src="/assets/application.js" type="text/javascript"></script>
</head>
的内容来自layouts/application.html.haml
:
%title= content_for?(:title) ? yield(:title) : "Composer Delete"
页面标题显示为“配置文件”
你知道为什么这个规范会失败吗
轨道3.2.3
Ruby 1.9.3是Capybara 2.0的bug(或特性:)。尝试使用以前的版本(1.1.2适合我)
具有\u标题的拉取请求?匹配器:
%title= content_for?(:title) ? yield(:title) : "Composer Delete"