Skip to content

Commit

Permalink
working on static pages
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarnhart committed Jan 28, 2012
1 parent c8a8eea commit 076897a
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 4 deletions.
19 changes: 19 additions & 0 deletions app/views/static_pages/about.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<% provide(:title, 'About') %>
<!DOCTYPE html>
<html>
<head>
<title>Ruby on Rails Tutorial Sample App | <%= yield(:title) %></title>
</head>
<body>
<h1>About Us</h1>
<p>
<a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
is a project to make a book and screencats to teach web development
with <a href="http://rubyonrails.org/">Ruby on Rails</a>. This
is the sample application for the tutorial.
</p>
<p>
I'm feeling lucky... Wait, that's workaholism.
</p>
</body>
</html>
18 changes: 16 additions & 2 deletions app/views/static_pages/help.html.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
<h1>StaticPages#help</h1>
<p>Find me in app/views/static_pages/help.html.erb</p>
<% provide(:title, 'Help') %>
<!DOCTYPE html>
<html>
<head>
<title>Ruby on Rails Tutorial Sample App | <%= yield(:title) %></title>
</head>
<body>
<h1>Help</h1>
<p>
Get help on Ruby on Rails Tutorial at the
<a href="http://railstutorial.org/help">Rails Tutorial help page</a>.
To get help on this sample app, see the
<a href="http://railstutorial.org/book">Rails Tutorial book</a>.
</p>
</body>
</html>
17 changes: 15 additions & 2 deletions app/views/static_pages/home.html.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
<h1>StaticPages#home</h1>
<p>Find me in app/views/static_pages/home.html.erb</p>
<% provide(:title, 'Home') %>
<!DOCTYPE html>
<html>
<head>
<title>Ruby on Rails Tutorial Sample App | <%= yield(:title) %></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>
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

get "static_pages/help"

get "static_pages/about"

# The priority is based upon order of creation:
# first created -> highest priority.

Expand Down
40 changes: 40 additions & 0 deletions spec/requests/static_pages_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
require 'spec_helper'

describe "Static pages" do

describe "Home page" do
it "should have the content 'Sample App'" do
visit '/static_pages/home'
page.should have_selector('h1', :text=>'Sample App')
end
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
end

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

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

0 comments on commit 076897a

Please sign in to comment.