Commit df59f375 by Tan Phat Nguyen

finish static pages

parent 610ab609
...@@ -4,4 +4,7 @@ class StaticPagesController < ApplicationController ...@@ -4,4 +4,7 @@ class StaticPagesController < ApplicationController
def help def help
end end
def about
end
end end
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>SampleApp</title> <title><%= yield(:title) %> | Ruby on Rails Tutorial Sample App</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
......
<% provide(:title, "About") %>
<h1>About</h1>
<p>
The <a href="http://www.railstutorial.org/"><em>Ruby on Rails
Tutorial</em></a> is a
<a href="http://www.railstutorial.org/book">book</a> and
<a href="http://screencasts.railstutorial.org/">screencast series</a>
to teach web development with
<a href="http://rubyonrails.org/">Ruby on Rails</a>.
This is the sample application for the tutorial.
</p>
\ No newline at end of file
<h1>StaticPages#help</h1> <% provide(:title, "Help") %>
<p>Find me in app/views/static_pages/help.html.erb</p> <h1>Help</h1>
<p>
Get help on the Ruby on Rails Tutorial at the
<a href="http://www.railstutorial.org/#help">Rails Tutorial help section</a>.
To get help on this sample app, see the
<a href="http://www.railstutorial.org/book"><em>Ruby on Rails Tutorial</em>
book</a>.
</p>
\ No newline at end of file
<h1>StaticPages#home</h1> <% provide(:title, "Home") %>
<p>Find me in app/views/static_pages/home.html.erb</p> <h1>Sample App</h1>
<p>
This is the home page for the
<a href="http://www.railstutorial.org/">Ruby on Rails Tutorial</a>
sample application.
</p>
\ No newline at end of file
Rails.application.routes.draw do Rails.application.routes.draw do
root 'static_pages#home'
get 'static_pages/home' get 'static_pages/home'
get 'static_pages/help' get 'static_pages/help'
get 'static_pages/about'
# The priority is based upon order of creation: first created -> highest priority. # The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes". # See how all your routes lay out with "rake routes".
......
...@@ -4,11 +4,19 @@ class StaticPagesControllerTest < ActionController::TestCase ...@@ -4,11 +4,19 @@ class StaticPagesControllerTest < ActionController::TestCase
test "should get home" do test "should get home" do
get :home get :home
assert_response :success assert_response :success
assert_select "title", "Home | Ruby on Rails Tutorial Sample App"
end end
test "should get help" do test "should get help" do
get :help get :help
assert_response :success assert_response :success
assert_select "title", "Help | Ruby on Rails Tutorial Sample App"
end
test "should get about" do
get :about
assert_response :success
assert_select "title", "About | Ruby on Rails Tutorial Sample App"
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment