Skip to content

Commit d6f63f1

Browse files
author
wenjieyeo
committed
Add a Static Pages controller
1 parent 2862dbf commit d6f63f1

File tree

8 files changed

+37
-0
lines changed

8 files changed

+37
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Place all the behaviors and hooks related to the matching controller here.
2+
# All this logic will automatically be available in application.js.
3+
# You can use CoffeeScript in this file: http://coffeescript.org/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Place all the styles related to the StaticPages controller here.
2+
// They will automatically be included in application.css.
3+
// You can use Sass (SCSS) here: http://sass-lang.com/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class StaticPagesController < ApplicationController
2+
def home
3+
end
4+
5+
def help
6+
end
7+
end

app/helpers/static_pages_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module StaticPagesHelper
2+
end

app/views/static_pages/help.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<h1>StaticPages#help</h1>
2+
<p>Find me in app/views/static_pages/help.html.erb</p>

app/views/static_pages/home.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<h1>StaticPages#home</h1>
2+
<p>Find me in app/views/static_pages/home.html.erb</p>

config/routes.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
Rails.application.routes.draw do
2+
get 'static_pages/home'
3+
4+
get 'static_pages/help'
5+
26
resources :microposts
37
resources :users
48
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
require 'test_helper'
2+
3+
class StaticPagesControllerTest < ActionDispatch::IntegrationTest
4+
test "should get home" do
5+
get static_pages_home_url
6+
assert_response :success
7+
end
8+
9+
test "should get help" do
10+
get static_pages_help_url
11+
assert_response :success
12+
end
13+
14+
end

0 commit comments

Comments
 (0)