Skip to content

Commit

Permalink
Done with static pages
Browse files Browse the repository at this point in the history
  • Loading branch information
MrEdwardo committed Apr 27, 2011
1 parent 714c3cb commit dbaced1
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 40 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .autotest
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require 'autotest/growl'
require 'autotest/fsevent'
6 changes: 6 additions & 0 deletions app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
class PagesController < ApplicationController
def home
@title = "Home"
end

def contact
@title = "Contact"
end

def about
@title = "About"
end

end
Binary file modified app/views/.DS_Store
Binary file not shown.
18 changes: 7 additions & 11 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>SampleApp</title>
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :defaults %>
<%= csrf_meta_tag %>
</head>
<body>

<%= yield %>

</body>
<head>
<title>Ruby on Rails Tutorial Sample App | <%= @title %></title>
<%= csrf_meta_tag %>
</head>
<body>
<%= yield %>
</body>
</html>
Binary file added app/views/pages/.DS_Store
Binary file not shown.
7 changes: 7 additions & 0 deletions app/views/pages/about.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<h1>About Us</h1>
<p>
<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>
7 changes: 5 additions & 2 deletions app/views/pages/contact.html.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
<h1>Pages#contact</h1>
<p>Find me in app/views/pages/contact.html.erb</p>
<h1>Contact</h1>
<p>
Contact Ruby on Rails Tutorial about the sample app at the
<a href="http://railstutorial.org/feedback">feedback page</a>.
</p>
8 changes: 6 additions & 2 deletions app/views/pages/home.html.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
<h1>Pages#home</h1>
<p>Find me in app/views/pages/home.html.erb</p>
<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>
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
get "pages/home"

get "pages/contact"

get "pages/about"

# The priority is based upon order of creation:
# first created -> highest priority.
Expand Down
Binary file added spec/.DS_Store
Binary file not shown.
27 changes: 27 additions & 0 deletions spec/controllers/pages_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,46 @@
require 'spec_helper'

describe PagesController do
render_views

describe "GET 'home'" do
it "should be successful" do
get 'home'
response.should be_success
end

it "should have the right title" do
get 'home'
response.should have_selector("title",
:content => "Ruby on Rails Tutorial Sample App | Home")
end
end

describe "GET 'contact'" do
it "should be successful" do
get 'contact'
response.should be_success
end

it "should have the right title" do
get 'contact'
response.should have_selector("title",
:content =>
"Ruby on Rails Tutorial Sample App | Contact")
end
end

describe "GET 'about'" do
it "should be successful" do
get 'about'
response.should be_success
end

it "should have the right title" do
get 'about'
response.should have_selector("title",
:content =>
"Ruby on Rails Tutorial Sample App | About")
end
end
end
15 changes: 0 additions & 15 deletions spec/helpers/pages_helper_spec.rb

This file was deleted.

5 changes: 0 additions & 5 deletions spec/views/pages/contact.html.erb_spec.rb

This file was deleted.

5 changes: 0 additions & 5 deletions spec/views/pages/home.html.erb_spec.rb

This file was deleted.

0 comments on commit dbaced1

Please sign in to comment.