From a6f6d059b3012a9d0d440625fde589d339a33f30 Mon Sep 17 00:00:00 2001 From: Hugo Leeney Date: Thu, 31 Jan 2013 17:34:41 +0000 Subject: [PATCH] Static pages. --- app/controllers/static_pages_controller.rb | 3 +++ app/views/static_pages/about.html.erb | 5 +++++ app/views/static_pages/help.html.erb | 4 ++-- app/views/static_pages/home.html.erb | 7 +++++-- config/routes.rb | 2 ++ spec/requests/static_pages_spec.rb | 22 ++++++++++++++++++++++ 6 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 app/views/static_pages/about.html.erb create mode 100644 spec/requests/static_pages_spec.rb diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb index c76b925..19f79a9 100644 --- a/app/controllers/static_pages_controller.rb +++ b/app/controllers/static_pages_controller.rb @@ -4,4 +4,7 @@ def home def help end + + def about + end end diff --git a/app/views/static_pages/about.html.erb b/app/views/static_pages/about.html.erb new file mode 100644 index 0000000..56682d4 --- /dev/null +++ b/app/views/static_pages/about.html.erb @@ -0,0 +1,5 @@ +

About Us

+

+Blah blah blah.. +

+ diff --git a/app/views/static_pages/help.html.erb b/app/views/static_pages/help.html.erb index 61896f5..59abcc2 100644 --- a/app/views/static_pages/help.html.erb +++ b/app/views/static_pages/help.html.erb @@ -1,2 +1,2 @@ -

StaticPages#help

-

Find me in app/views/static_pages/help.html.erb

+

Help

+

Get help on the 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/app/views/static_pages/home.html.erb b/app/views/static_pages/home.html.erb index af94c7f..47f3f14 100644 --- a/app/views/static_pages/home.html.erb +++ b/app/views/static_pages/home.html.erb @@ -1,2 +1,5 @@ -

StaticPages#home

-

Find me in app/views/static_pages/home.html.erb

+

Sample App

+ +

+This is the home page for the Ruby on Rails Tutorial sample application. +

diff --git a/config/routes.rb b/config/routes.rb index 10ab8d2..fa7b30d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,6 +2,8 @@ get "static_pages/home" get "static_pages/help" + + get "static_pages/about" # The priority is based upon order of creation: # first created -> highest priority. diff --git a/spec/requests/static_pages_spec.rb b/spec/requests/static_pages_spec.rb new file mode 100644 index 0000000..791686e --- /dev/null +++ b/spec/requests/static_pages_spec.rb @@ -0,0 +1,22 @@ +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_content('Sample App') + end + end + describe "Help page" do + it "should have the content 'Sample App'" do + visit '/static_pages/help' + page.should have_content('Help') + end + end + describe "About page" do + it "should have the content 'About Us'" do + visit '/static_pages/about' + page.should have_content('About Us') + end + end +end