Skip to content

Instantly share code, notes, and snippets.

@andrewhl
Created October 17, 2011 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewhl/1293937 to your computer and use it in GitHub Desktop.
Save andrewhl/1293937 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Ruby on Rails Tutorial Sample App | Home</title>
</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>
require 'spec_helper'
describe PagesController do
describe "GET 'home'" do
it "returns http success" do
get 'home'
response.should be_success
end
it "should have the right title" do
get 'home'
response.should have_selector("title",
:content => "Ruby on Rails Tutorial Sample App | Home")
end
end
describe "GET 'contact'" do
it "returns http success" do
get 'contact'
response.should be_success
end
end
describe "GET 'about'" do
it "returns http success" do
get 'about'
response.should be_success
end
end
end
Failures:
1) PagesController GET 'home' should have the right title
Failure/Error: response.should have_selector("title",
expected css "title" to return something
# ./spec/controllers/pages_controller_spec.rb:13:in `block (3 levels) in <top (required)>'
Finished in 4.7 seconds
4 examples, 1 failure
Failed examples:
rspec ./spec/controllers/pages_controller_spec.rb:11 # PagesController GET 'home' should have the right title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment