diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 18ea3c5..7315f6d 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -11,4 +11,8 @@ def about @title = "About" end + def help + @title = "Help" + end + end diff --git a/app/views/pages/help.html.erb b/app/views/pages/help.html.erb new file mode 100644 index 0000000..9a82e8d --- /dev/null +++ b/app/views/pages/help.html.erb @@ -0,0 +1,7 @@ +

Help

+

+ Get help on Ruby on Rails Tutorial at the + Rails Tutorial help page + To get help on this sample app, see the + Rails Tutorial book +

diff --git a/config/routes.rb b/config/routes.rb index 522e9db..56797b7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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. diff --git a/spec/controllers/pages_controller_spec.rb b/spec/controllers/pages_controller_spec.rb index ebefd1c..46f8133 100644 --- a/spec/controllers/pages_controller_spec.rb +++ b/spec/controllers/pages_controller_spec.rb @@ -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 @@ -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 @@ -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 @@ -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