Skip to content

Commit 391c8f5

Browse files
committed
add Contact
1 parent 7e482f4 commit 391c8f5

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

app/controllers/static_pages_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ def help
77

88
def about
99
end
10+
def contact
11+
end
1012
end
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<% provide(:title, "Contact") %>
2+
<h1>Contact</h1>
3+
<p>
4+
Contact the Ruby on Rails Tutorial about the sample app at the
5+
<a href="http://www.railstutorial.org/#contact">contact page</a>.
6+
</p>

config/routes.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
root 'static_pages#home'
33
get 'static_pages/help'
44
get 'static_pages/about'
5+
get 'static_pages/contact'
56

67

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

test/controllers/static_pages_controller_test.rb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
11
require 'test_helper'
22

33
class StaticPagesControllerTest < ActionController::TestCase
4+
5+
def setup
6+
@base_title = "Ruby on Rails Tutorial Sample App"
7+
8+
end
49
test "should get home" do
510
get :home
611
assert_response :success
7-
assert_select "title", "Home | Ruby on Rails Tutorial Sample App"
12+
assert_select "title", "Home | #{@base_title}"
813
end
914
test "should get about" do
1015
get :about
1116
assert_response :success
12-
assert_select "title", "About | Ruby on Rails Tutorial Sample App"
17+
assert_select "title", "About | #{@base_title}"
1318
end
1419

1520
test "should get help" do
1621
get :help
1722
assert_response :success
18-
assert_select "title", "Help | Ruby on Rails Tutorial Sample App"
23+
assert_select "title", "Help | #{@base_title}"
24+
end
25+
test "should get contact" do
26+
get :contact
27+
assert_response :success
28+
assert_select "title", "Contact | #{@base_title}"
1929
end
2030
#test "shout get about" do
2131
# get :static_pages_help_url

0 commit comments

Comments
 (0)