Skip to content

Commit

Permalink
Finish static pages
Browse files Browse the repository at this point in the history
  • Loading branch information
aplarson committed Aug 25, 2014
1 parent f119a93 commit cf58c57
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 5 deletions.
3 changes: 3 additions & 0 deletions app/controllers/static_pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ def home

def help
end

def about
end
end
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>SampleApp</title>
<title>Ruby on Rails Tutorial Sample Application | <%= yield(:title) %></title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
Expand Down
5 changes: 5 additions & 0 deletions app/views/static_pages/about.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<% provide(:title, 'About') %>
<h1>About Us</h1>
<p>
The <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a> is a project to make a book and screencasts to teach web development with <a href="http://rubyonrails.org/">Ruby on Rails</a>. This is the sample application for the tutorial.
</p>
8 changes: 6 additions & 2 deletions app/views/static_pages/help.html.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
<h1>StaticPages#help</h1>
<p>Find me in app/views/static_pages/help.html.erb</p>
<% provide(:title, 'Help') %>
<h1>Help</h1>
<p>
Get help on the Ruby on Rails Tutorial at the <a href="http://railstutorial.org/help">Rails Tutorial help page</a>.
To get help on this sample app, see the <a href="http://railstutorial.org/book">Rails Tutorial book</a>.
</p>
7 changes: 5 additions & 2 deletions app/views/static_pages/home.html.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
<h1>StaticPages#home</h1>
<p>Find me in app/views/static_pages/home.html.erb</p>
<% provide(:title, 'Home') %>
<h1>Sample App</h1>
<p>
This is the home page for the <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a> sample application.
</p>
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
SampleApp::Application.routes.draw do
get "static_pages/home"
get "static_pages/help"
get "static_pages/about"
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".

Expand Down
43 changes: 43 additions & 0 deletions spec/requests/static_pages_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
require 'spec_helper'

describe "StaticPages" do

describe "Home page" do

it "should have the content 'Sample App'" do
visit '/static_pages/home'
expect(page).to have_content('Sample App')
end

it "should have the title 'Home'" do
visit '/static_pages/home'
expect(page).to have_title("Ruby on Rails Tutorial Sample Application | Home")
end
end

describe "Help page" do

it "should have the content 'Help'" do
visit '/static_pages/help'
expect(page).to have_content('Help')
end

it "should have the title 'Help'" do
visit '/static_pages/help'
expect(page).to have_title("Ruby on Rails Tutorial Sample Application | Help")
end
end

describe "About page" do

it "should have the content 'About Us'" do
visit '/static_pages/about'
expect(page).to have_content('About Us')
end

it "should have the title 'About'" do
visit '/static_pages/about'
expect(page).to have_title("Ruby on Rails Tutorial Sample Application | About")
end
end
end
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@
# the seed, which is printed after each run.
# --seed 1234
config.order = "random"
config.include Capybara::DSL
end

0 comments on commit cf58c57

Please sign in to comment.