Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9042121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T10:24:28+00:00 2026-06-16T10:24:28+00:00

I have the following spec describe user enters 150 into time do before do

  • 0

I have the following spec

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

It’s failing with the following message:

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.

The source code (from save_and_open_page) contains this head section:

<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>

Here is the view:

- content_for :title do
  Profile
%h1 Profile
%table.table.table-striped
  %thead
    %tr
      %th Name
  %tbody
  - current_user.workouts.each do |workout|
    %tr
      %td= link_to workout.name, workout
      %td= link_to "Edit", edit_profile_workout_url(workout)
      %td= link_to "Remove", profile_workout_url(workout), method: :delete, confirm: "Are you sure?"
= link_to "Create New Workout", new_profile_workout_url

And the content_for is from layouts/application.html.haml:

%title= content_for?(:title) ? yield(:title) : "Composer Delete"

The title of the page is being displayed as “Profile”.

Any ideas why this spec is failing?

Rails 3.2.3

Ruby 1.9.3

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T10:24:29+00:00Added an answer on June 16, 2026 at 10:24 am

    It’s Capybara 2.0 bug (or feature 🙂 . Try to use previous versions (1.1.2 works fine for me).

    https://github.com/jnicklas/capybara/issues/844

    pull request with has_title? matcher:

    https://github.com/jnicklas/capybara/issues/844

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following Rspec test: describe Productlimit do before(:each) do @productlimit = Factory.create(:productlimit, :user
I have the following rspec: require 'spec_helper' describe KnowledgesController do before (:each) do @knowledge
I have the following code: require_relative '../spec_helper' describe PaymentProcessor do before(:each) do @processor =
I have the following test block in rspec: describe for signed-in users do let(:user)
I have following spec to test controller method: context #create do it should redirect
I have the following spec: it saves a default 'active' status if not specified
Running rails 3.2.3 with guard/spork/rspec/factory_girl and have the following in my spec helper: Spork.prefork
In a branch spec, I have the following view: //depot/dev/t/a/g/... //depot/dev/t/r/g/... -//depot/dev/t/a/g/p/o*/... //depot/dev/t/r/g/p/... Perforce
I have the following rspec code: require 'spec_helper' require 'mocha' require 'rr' describe ProjectsController,
I´m testing my rails app using rspec and remarkable. I have the following spec

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.