Skip to content

Commit

Permalink
Finish static pages
Browse files Browse the repository at this point in the history
  • Loading branch information
bomatson committed May 18, 2012
1 parent 6513622 commit d5e617d
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 5 deletions.
9 changes: 9 additions & 0 deletions app/controllers/static_pages_controller.rb
@@ -1,7 +1,16 @@
class StaticPagesController < ApplicationController
def home
end

#render as html the static ruby page

def help
end

def about
end

def contact
end

end
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>SampleApp</title>
<title>Ruby on Rails Tutorial Sample App | <%= yield(:title)%></title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
Expand Down
6 changes: 6 additions & 0 deletions app/views/static_pages/about.html.erb
@@ -0,0 +1,6 @@
<% provide(:title, 'About Us') %>

<h1>About Us</h1>
<p>
My name is Bobby Matson. And this is a tutorial! Yay!
</p>
8 changes: 8 additions & 0 deletions app/views/static_pages/contact.html.erb
@@ -0,0 +1,8 @@
<% provide(:title, 'Contact')%>

<h1>Contact</h1>

<p>
This is the contact page! I'm one person in LA. Contact me by Googling "Bobby Matson"
</p>

11 changes: 9 additions & 2 deletions app/views/static_pages/help.html.erb
@@ -1,2 +1,9 @@
<h1>StaticPages#help</h1>
<p>Find me in app/views/static_pages/help.html.erb</p>
<% provide(:title, 'Help') %>

<h1>Help</h1>
<p>
Get help on the Ruby on Rails Tutorial at the
<a href="http://railstutorial.org/help">Ruby on Rails Tutorial Help</a>.
To get help on this sample app, see the
<a href="http://railstutorial.org/book">Rails Book</a>
</p>
10 changes: 8 additions & 2 deletions app/views/static_pages/home.html.erb
@@ -1,2 +1,8 @@
<h1>StaticPages#home</h1>
<p>Find me in app/views/static_pages/home.html.erb</p>
<% provide(:title, 'Home') %>

<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>
4 changes: 4 additions & 0 deletions config/routes.rb
Expand Up @@ -2,6 +2,10 @@
get "static_pages/home"

get "static_pages/help"

get "static_pages/about"

get "static_pages/contact"

# The priority is based upon order of creation:
# first created -> highest priority.
Expand Down
60 changes: 60 additions & 0 deletions spec/requests/static_pages_spec.rb
@@ -0,0 +1,60 @@
require 'spec_helper'

describe "StaticPages" 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 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 content 'About us'" do
visit "/static_pages/about"
page.should have_selector('h1', :text => 'About Us')
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 Us")
end
end

describe "Contact" do

it "should have content 'Contact'" do
visit "/static_pages/contact"
page.should have_selector('h1', :text => 'Contact')
end

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

0 comments on commit d5e617d

Please sign in to comment.