Skip to content

Commit

Permalink
added contact page
Browse files Browse the repository at this point in the history
  • Loading branch information
skyhirider committed Jun 1, 2013
1 parent c9e7d50 commit 391ce63
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 6 deletions.
3 changes: 3 additions & 0 deletions app/controllers/static_pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ def help
def about
end

def contact
end

end
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>Ruby on Rails Tutorial Sample App | <% yield(:title) %> </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
2 changes: 1 addition & 1 deletion app/views/static_pages/about.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% provide(:title,'About') %>
<% provide(:title,'About Us') %>
<h1>About Us</h1>
<p>
The <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
Expand Down
7 changes: 7 additions & 0 deletions app/views/static_pages/contact.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<% provide(:title, 'Contact Us') %>
<h1>Our contact info</h1>
<p>
This is the contact page for the
<a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
sample application.
</p>
2 changes: 1 addition & 1 deletion app/views/static_pages/home.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% provide(:title,'Home') %>
<% provide(:title, 'Home') %>
<h1>Sample App</h1>
<p>
This is the home page for the
Expand Down
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

get "static_pages/about"

get "static_pages/contact"

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

Expand Down
24 changes: 21 additions & 3 deletions spec/requests/static_pages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

describe "Static pages" do

let(:base_title) {"Ruby on Rails Tutorial Sample App"}


describe "Home page" do

it "should have the h1 'Sample App'" do
Expand All @@ -12,7 +15,7 @@
it "should have the title 'Home'" do
visit '/static_pages/home'
page.should have_selector('title',
:text => "Ruby on Rails Tutorial Sample App | Home")
:text => "#{base_title} | Home")
end
end

Expand All @@ -26,7 +29,7 @@
it "should have the title 'Help'" do
visit '/static_pages/help'
page.should have_selector('title',
:text => "Ruby on Rails Tutorial Sample App | Help")
:text => "#{base_title} | Help")
end
end

Expand All @@ -40,7 +43,22 @@
it "should have the title 'About Us'" do
visit '/static_pages/about'
page.should have_selector('title',
:text => "Ruby on Rails Tutorial Sample App | About Us")
:text => "#{base_title} | About Us")
end
end

describe "Contact Us" do

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

it "should have the title 'Contact Us'" do
visit '/static_pages/contact'
page.should have_selector('title',
:text => "#{base_title} | Contact Us")
end
end

end

0 comments on commit 391ce63

Please sign in to comment.