Permalink
Browse files

Done with static pages

  • Loading branch information...
mikeaddison93 committed Apr 18, 2011
1 parent a0218c0 commit b5624230ffe4675a1bab9cff5065498d0a6f5abb
View
@@ -0,0 +1,4 @@
+require 'autotest/growl'
+require 'autotest/fsevent'
+require 'redgreen/autotest'
+require "autotest/restart"
View
2 .rspec
@@ -1 +1,3 @@
--colour
+--drb
+
View
@@ -14,6 +14,7 @@ end
group :test do
gem 'rspec', '2.5.0'
gem 'webrat', '0.7.1'
+ gem 'spork', '~> 0.9.0.rc'
end
# Use unicorn as the web server
View
@@ -74,6 +74,7 @@ GEM
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.5.0)
+ spork (0.9.0.rc5)
sqlite3-ruby (1.3.2)
thor (0.14.6)
treetop (1.4.9)
@@ -91,5 +92,6 @@ DEPENDENCIES
rails (= 3.0.6)
rspec (= 2.5.0)
rspec-rails (= 2.5.0)
+ spork (~> 0.9.0.rc)
sqlite3-ruby (= 1.3.2)
webrat (= 0.7.1)
@@ -1,8 +1,14 @@
class PagesController < ApplicationController
def home
+ @title = "Home"
end
def contact
+ @title = "Contact"
+ end
+
+ def about
+ @title = "About"
end
end
@@ -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>
@@ -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>
@@ -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>
@@ -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>
View
@@ -1,7 +1,7 @@
SampleApp::Application.routes.draw do
get "pages/home"
-
get "pages/contact"
+ get "pages/about"
# The priority is based upon order of creation:
# first created -> highest priority.
@@ -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
@@ -1,15 +0,0 @@
-require 'spec_helper'
-
-# Specs in this file have access to a helper object that includes
-# the PagesHelper. For example:
-#
-# describe PagesHelper do
-# describe "string concat" do
-# it "concats two strings with spaces" do
-# helper.concat_strings("this","that").should == "this that"
-# end
-# end
-# end
-describe PagesHelper do
- pending "add some examples to (or delete) #{__FILE__}"
-end
View
@@ -1,3 +1,50 @@
+require 'rubygems'
+require 'spork'
+
+Spork.prefork do
+ # Loading more in this block will cause your tests to run faster. However,
+ # if you change any configuration or code from libraries loaded here, you'll
+ # need to restart spork for it take effect.
+
+end
+
+Spork.each_run do
+ # This code will be run each time you run your specs.
+
+end
+
+# --- Instructions ---
+# Sort the contents of this file into a Spork.prefork and a Spork.each_run
+# block.
+#
+# The Spork.prefork block is run only once when the spork server is started.
+# You typically want to place most of your (slow) initializer code in here, in
+# particular, require'ing any 3rd-party gems that you don't normally modify
+# during development.
+#
+# The Spork.each_run block is run each time you run your specs. In case you
+# need to load files that tend to change during development, require them here.
+# With Rails, your application modules are loaded automatically, so sometimes
+# this block can remain empty.
+#
+# Note: You can modify files loaded *from* the Spork.each_run block without
+# restarting the spork server. However, this file itself will not be reloaded,
+# so if you change any of the code inside the each_run block, you still need to
+# restart the server. In general, if you have non-trivial code in this file,
+# it's advisable to move it into a separate file so you can easily edit it
+# without restarting spork. (For example, with RSpec, you could move
+# non-trivial code into a file spec/support/my_helper.rb, making sure that the
+# spec/support/* files are require'd from inside the each_run block.)
+#
+# Any code that is left outside the two blocks will be run during preforking
+# *and* during each_run -- that's probably not what you want.
+#
+# These instructions should self-destruct in 10 seconds. If they don't, feel
+# free to delete them.
+
+
+
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
@@ -1,5 +0,0 @@
-require 'spec_helper'
-
-describe "pages/contact.html.erb" do
- pending "add some examples to (or delete) #{__FILE__}"
-end
@@ -1,5 +0,0 @@
-require 'spec_helper'
-
-describe "pages/home.html.erb" do
- pending "add some examples to (or delete) #{__FILE__}"
-end

0 comments on commit b562423

Please sign in to comment.