Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/63.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_Capybara - Fatal编程技术网

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"