Skip to content

Commit

Permalink
Done with exercises with static pages
Browse files Browse the repository at this point in the history
  • Loading branch information
ndesell committed May 20, 2011
1 parent 55a7e8b commit f05443d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
4 changes: 4 additions & 0 deletions app/controllers/pages_controller.rb
Expand Up @@ -11,4 +11,8 @@ def about
@title = "About"
end

def help
@title = "Help"
end

end
7 changes: 7 additions & 0 deletions app/views/pages/help.html.erb
@@ -0,0 +1,7 @@
<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>
1 change: 1 addition & 0 deletions config/routes.rb
Expand Up @@ -2,6 +2,7 @@
get "pages/home"
get "pages/contact"
get "pages/about"
get "pages/help"

# The priority is based upon order of creation:
# first created -> highest priority.
Expand Down
13 changes: 10 additions & 3 deletions spec/controllers/pages_controller_spec.rb
Expand Up @@ -2,6 +2,10 @@

describe PagesController do
render_views

before(:each) do
@base_title = "Ruby on Rails Tutorial Sample App"
end

describe "GET 'home'" do
it "should be successful" do
Expand All @@ -12,7 +16,7 @@
it "should have the right title" do
get 'home'
response.should have_selector("title",
:content => "Ruby on Rails Tutorial Sample App | Home")
:content => @base_title + " | Home")
end
end

Expand All @@ -25,8 +29,9 @@
it "should have the right title" do
get 'contact'
response.should have_selector("title",
:content => "Ruby on Rails Tutorial Sample App | Contact")
:content => @base_title + " | Contact")
end
end

describe "GET 'about'" do
it "should be successful" do
Expand All @@ -37,7 +42,9 @@
it "should have the right title" do
get 'about'
response.should have_selector("title",
:content => "Ruby on Rails Tutorial Sample App | About")
:content => @base_title + " | About")
end
end


end

0 comments on commit f05443d

Please sign in to comment.