probando con las especificaciones, capybara de railstutorial capítulo 3 no funciona (have_selector ('title',: text => '| Home'))

Estoy trabajando en ruby.railstutorial.org/ruby-on-rails-tutorial-book. Im usando rieles 3.2.7, spork, rspec, capybara, launchy y algunos guardias :)

Tengo un problema realmente extraño en el Capítulo 3 con las pruebas:

Parece que las pruebas no están funcionando para lo que está dentro del<head>-Etiqueta. Si pongo el<title>-tiqueta dentro de la<body>-tiqueta en lugar de la etiqueta de cabecera funciona bien. También funciona cuando lo pongo.<h1>-tags encima de la<title> dentro<head>-Tags. Es raro, ¿verdad?

Por favor, ayúdame a averiguar.

El ejemplo es de: ruby.railstutorial.org/chapters/static-pages#code:title_test:

it "should have the right title" do
  visit '/static_pages/home'
  page.should have_selector('title',
                    :text => "Ruby on Rails Tutorial Sample App | Home")
end

El mensaje de error es:

Fallas:

1) Páginas estáticas La página de inicio debe tener el título 'Inicio' Error / Error: page.should have_selector ('title',: text => '| Home') Capybara :: ExpectationNotMet: se espera que encuentre el css "title" con texto " | Inicio "pero no hubo partidos. También se encuentra "", que coincide con el selector pero no con todos los filtros. # ./spec/requests/static_pages_spec.rb:15:in `bloque (3 niveles) en '

Ese está funcionando:

it "should have the h1 'Sample App'" do
  visit '/static_pages/home'
  page.should have_selector('h1', :text => 'Sample App')
end

el archivo HTML renderizado:

<!DOCTYPE html>
<html>
<head>
  <title>Ruby on Rails Tutorial Sample App | Home</title>
  <!-- some css,js stuff -->
</head>
<body>

<h1>Sample App</h1>
<p>
  This is the home page for the
  <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
  sample application
</p>

</body>
</html>

Gracias

Editar: puedes encontrar los archivos con los que trabajo en github:https://github.com/farukg/sample_app/

el enlace al archivo de especificaciones:https://github.com/farukg/sample_app/blob/master/spec/requests/static_pages_spec.rb

Explicación de lo que hice: El código para la página de inicio es como debería ser. El código para la página tiene su propio diseño con una etiqueta h1 encima de la etiqueta del título dentro para mostrar que funciona por algún tipo de razón. Y finalmente, la página de ayuda tiene su etiqueta de título dentro de las etiquetas del cuerpo que también funciona.

Estoy absolutamente confundido, ¿por qué tengo un comportamiento tan extraño?

La salida completa de guardia:

> Run all
Bundle already up-to-date
Running all specs
Running tests with args ["--drb", "--colour", "-f", "progress", "-r", "/home/faruk/.rvm/gems/ruby-1.9.3-p125/gems/guard-rspec-1.2.0/lib/guard/rspec/formatters/notification_rspec.rb", "-f", "Guard::RSpec::Formatter::NotificationRSpec", "--out", "/dev/null", "--failure-exit-code", "2", "spec"]...
..FFF.....Neues Fenster in aktueller Browsersitzung erstellt.
.FF..

Failures:

  1) Static pages Home page having application layout should have_selector head title 'Home'
     Failure/Error: page.should have_selector('head title',
     Capybara::ExpectationNotMet:
       expected to find css "head title" with text "Ruby on Rails Tutorial Sample App | Home" but there were no matches. Also found "", which matched the selector but not all filters.
     # ./spec/requests/static_pages_spec.rb:23:in `block (3 levels) in <top (required)>'

  2) Static pages Home page having application layout should have content 'Home'
     Failure/Error: page.should have_content("Ruby on Rails Tutorial Sample App | Home")
       expected there to be text "Ruby on Rails Tutorial Sample App | Home" in "Sample App This is the home page for the Ruby on Rails Tutorial sample application"
     # ./spec/requests/static_pages_spec.rb:30:in `block (3 levels) in <top (required)>'

  3) Static pages Home page having application layout should have css title 'Home'
     Failure/Error: page.should have_css("title", :text => "Ruby on Rails Tutorial Sample App | Home")
     Capybara::ExpectationNotMet:
       expected to find css "title" with text "Ruby on Rails Tutorial Sample App | Home" but there were no matches. Also found "", which matched the selector but not all filters.
     # ./spec/requests/static_pages_spec.rb:36:in `block (3 levels) in <top (required)>'

  4) Static pages about page with own layout should JUST have_selector head title 
     Failure/Error: page.should have_selector('head title')
     Capybara::ExpectationNotMet:
       expected to find css "head title" but there were no matches
     # ./spec/requests/static_pages_spec.rb:86:in `block (3 levels) in <top (required)>'

  5) Static pages about page with own layout should have_selector head title 'About Us'
     Failure/Error: page.should have_selector('head title',
     Capybara::ExpectationNotMet:
       expected to find css "head title" with text "Ruby on Rails Tutorial Sample App | About Us" but there were no matches
     # ./spec/requests/static_pages_spec.rb:93:in `block (3 levels) in <top (required)>'

Finished in 0.66215 seconds
15 examples, 5 failures

Failed examples:

rspec ./spec/requests/static_pages_spec.rb:20 # Static pages Home page having application layout should have_selector head title 'Home'
rspec ./spec/requests/static_pages_spec.rb:27 # Static pages Home page having application layout should have content 'Home'
rspec ./spec/requests/static_pages_spec.rb:33 # Static pages Home page having application layout should have css title 'Home'
rspec ./spec/requests/static_pages_spec.rb:83 # Static pages about page with own layout should JUST have_selector head title 
rspec ./spec/requests/static_pages_spec.rb:90 # Static pages about page with own layout should have_selector head title 'About Us'
Done.

> Neues Fenster in aktueller Browsersitzung erstellt.
Neues Fenster in aktueller Browsersitzung erstellt.

Respuestas a la pregunta(6)

Su respuesta a la pregunta