KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
im working on ruby.railstutorial.org/ruby-on-rails-tutorial-book. Im using rails 3.2.7, spork, rspec, capybara, launchy and some guards :) i have a really weird problem in Chapter 3 with testing: It seems like the tests arent working for what is inside the <head> -Tag. If i put the <title> -tag inside the <body> -tag instead of the head-tag it works fine. Also it works when i put <h1> -tags above the <title> inside <head> -Tags. It is weird, isnt it? Please help me figur out. The example is from : 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 The Error-Message is: Failures: 1) Static pages Home page should have the title 'Home' Failure/Error: page.should have_selector('title', :text => ' | Home') Capybara::ExpectationNotMet: expected to find css "title" with text " | Home" but there were no matches. Also found "", which matched the selector but not all filters. # ./spec/requests/static_pages_spec.rb:15:in `block (3 levels) in ' That one is working: it "should have the h1 'Sample App'" do visit '/static_pages/home' page.should have_selector('h1', :text => 'Sample App') end the rendered HTML-file: <!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>
Tags (comma-separated)
Save Edits
Cancel