Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 10 files changed
  • 0 comments
  • 1 contributor
3  app/assets/javascripts/static_pages.js.coffee
... ... @@ -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://jashkenas.github.com/coffee-script/
3  app/assets/stylesheets/static_pages.css.scss
... ... @@ -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/
7 app/controllers/static_pages_controller.rb
... ... @@ -0,0 +1,7 @@
  1 +class StaticPagesController < ApplicationController
  2 + def home
  3 + end
  4 +
  5 + def help
  6 + end
  7 +end
2  app/helpers/static_pages_helper.rb
... ... @@ -0,0 +1,2 @@
  1 +module StaticPagesHelper
  2 +end
20 app/views/layouts/application.html.erb
... ... @@ -1,14 +1,12 @@
1 1 <!DOCTYPE html>
2 2 <html>
3   -<head>
4   - <title>SampleApp</title>
5   - <%= stylesheet_link_tag "application", :media => "all" %>
6   - <%= javascript_include_tag "application" %>
7   - <%= csrf_meta_tags %>
8   -</head>
9   -<body>
10   -
11   -<%= yield %>
12   -
13   -</body>
  3 + <head>
  4 + <title>Ruby on Rails Tutorial Sample App | <%= yield(:title) %></title>
  5 + <%= stylesheet_link_tag "application", :media => "all" %>
  6 + <%= javascript_include_tag "application" %>
  7 + <%= csrf_meta_tags %>
  8 + </head>
  9 + <body>
  10 + <%= yield %>
  11 + </body>
14 12 </html>
8 app/views/static_pages/about.html.erb
... ... @@ -0,0 +1,8 @@
  1 +<% provide(:title, 'About Us') %>
  2 +<h1>About Us</h1>
  3 +<p>
  4 + The <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
  5 + is a project to make a book and screencasts to teach web development
  6 + with <a href="http://rubyonrails.org/">Ruby on Rails</a>. This
  7 + is the sample application for the tutorial.
  8 +</p>
8 app/views/static_pages/help.html.erb
... ... @@ -0,0 +1,8 @@
  1 +<% provide(:title, 'Help') %>
  2 +<h1>Help</h1>
  3 +<p>
  4 + Get help on the Ruby on Rails Tutorial at the
  5 + <a href="http://railstutorial.org/help">Rails Tutorial help page</a>.
  6 + To get help on this sample app, see the
  7 + <a href="http://railstutorial.org/book">Rails Tutorial book</a>.
  8 +</p>
7 app/views/static_pages/home.html.erb
... ... @@ -0,0 +1,7 @@
  1 +<% provide(:title, 'Home') %>
  2 +<h1>Sample App</h1>
  3 +<p>
  4 + This is the home page for the
  5 + <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
  6 + sample application.
  7 +</p>
5 config/routes.rb
... ... @@ -1,4 +1,9 @@
1 1 SampleApp::Application.routes.draw do
  2 + get "static_pages/home"
  3 + get "static_pages/help"
  4 + get "static_pages/about"
  5 +
  6 +
2 7 # The priority is based upon order of creation:
3 8 # first created -> highest priority.
4 9
46 spec/requests/static_pages_spec.rb
... ... @@ -0,0 +1,46 @@
  1 +require 'spec_helper'
  2 +
  3 +describe "Static pages" do
  4 +
  5 + describe "Home page" do
  6 +
  7 + it "should have the h1 'Sample App'" do
  8 + visit '/static_pages/home'
  9 + page.should have_selector('h1', :text => 'Sample App')
  10 + end
  11 +
  12 + it "should have the title 'Home'" do
  13 + visit '/static_pages/home'
  14 + page.should have_selector('title',
  15 + :text => "Ruby on Rails Tutorial Sample App | Home")
  16 + end
  17 + end
  18 +
  19 + describe "Help page" do
  20 +
  21 + it "should have the h1 'Help'" do
  22 + visit '/static_pages/help'
  23 + page.should have_selector('h1', :text => 'Help')
  24 + end
  25 +
  26 + it "should have the title 'Help'" do
  27 + visit '/static_pages/help'
  28 + page.should have_selector('title',
  29 + :text => "Ruby on Rails Tutorial Sample App | Help")
  30 + end
  31 + end
  32 +
  33 + describe "About page" do
  34 +
  35 + it "should have the h1 'About Us'" do
  36 + visit '/static_pages/about'
  37 + page.should have_selector('h1', :text => 'About Us')
  38 + end
  39 +
  40 + it "should have the title 'About Us'" do
  41 + visit '/static_pages/about'
  42 + page.should have_selector('title',
  43 + :text => "Ruby on Rails Tutorial Sample App | About Us")
  44 + end
  45 + end
  46 +end

No commit comments for this range

Something went wrong with that request. Please try again.