Cucumber / Selenium: Access and test document title

If you want to test that a certain text is contained within the document title of your page, you can do so using Selenium and a step such as

Then /^"(.*?)" should be shown in the document title$/ do |expectation|
  title = page.driver.browser.title
  title.should include(expectation)
end
Thomas Eisenbarth