title: Capybara/RSpec 'have_css' matcher not working but has_css does
body: <p>In a Rails 3.2.14 app with Ruby 2, using rspec-rails 2.14.0 and capybara 2.1.0 the following feature spec is causing a failure:</p>
  
  <pre><code>require 'spec_helper'
  
  feature 'View the homepage' do
    scenario 'user sees relevant page title' do
      visit root_path
      expect(page).to have_css('title', text: "Todo")
    end
  end
  </code></pre>
  
  <p>The failure message is:</p>
  
  <pre><code> 1) View the homepage user sees relevant page title
   Failure/Error: expect(page).to have_css('title', text: "Todo")
   Capybara::ExpectationNotMet:
     expected to find css "title" with text "Todo" but there were no matches. Also
     found "", which matched the selector but not all filters.
  </code></pre>
  
  <p><strong>The title element and correct text <em>are</em> on the rendered page</strong></p>
  
  <p>But when I change this line in the feature spec:</p>
  
  <pre><code>expect(page).to have_css('title', text: "Todo")
  </code></pre>
  
  <p>to this:</p>
  
  <pre><code>page.has_css?('title', text: "Todo")
  </code></pre>
  
  <p>then the test passes. [Edit - but see response below from @JustinKo that this test is not a good test as it will always pass]</p>
  
  <p><strong>How do I get the <code>have_css(...)</code> form to work? Is it a configuration issue?</strong></p>
  
  <p>Here's the relevant part of my <code>Gemfile</code>:</p>
  
  <pre><code>group :development, :test do
    gem 'rspec-rails' 
    gem 'capybara'
  end
  </code></pre>
  
  <p>And my <code>spec/spec_helper.rb</code> is set up like this:</p>
  
  <pre><code>ENV["RAILS_ENV"] ||= 'test'
  require File.expand_path("../../config/environment", __FILE__)
  require 'rspec/rails'
  require 'rspec/autorun'
  require 'capybara/rails'
  require 'capybara/rspec'
  
  Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
  
  RSpec.configure do |config|
  
    # out of the box rspec config code ommitted
  
    config.include Capybara::DSL
  end
  </code></pre>
  
  <p>Anyone know what I might be doing wrong?</p>