Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

done with static pages

  • Loading branch information...
commit 33659176fa81db23b22bbf1726261d6cf6dc6a18 1 parent 7f2c3d7
kielgillard authored
1  .rspec
... ... @@ -1 +1,2 @@
1 1 --colour
  2 +--drb
1  Gemfile
@@ -14,6 +14,7 @@ end
14 14 group :test do
15 15 gem 'rspec-rails', '2.6.1'
16 16 gem 'webrat', '0.7.1'
  17 + gem 'spork', '0.9.0.rc8'
17 18 end
18 19
19 20 # Use unicorn as the web server
2  Gemfile.lock
@@ -78,6 +78,7 @@ GEM
78 78 activesupport (~> 3.0)
79 79 railties (~> 3.0)
80 80 rspec (~> 2.6.0)
  81 + spork (0.9.0.rc8)
81 82 sqlite3 (1.3.3)
82 83 thor (0.14.6)
83 84 treetop (1.4.10)
@@ -95,5 +96,6 @@ PLATFORMS
95 96 DEPENDENCIES
96 97 rails (= 3.0.11)
97 98 rspec-rails (= 2.6.1)
  99 + spork (= 0.9.0.rc8)
98 100 sqlite3 (= 1.3.3)
99 101 webrat (= 0.7.1)
5 app/controllers/pages_controller.rb
... ... @@ -1,8 +1,13 @@
1 1 class PagesController < ApplicationController
2 2 def home
  3 + @title = "Home"
3 4 end
4 5
5 6 def contact
  7 + @title = "Contact"
6 8 end
7 9
  10 + def about
  11 + @title = "About"
  12 + end
8 13 end
19 app/views/layouts/application.html.erb
... ... @@ -1,14 +1,11 @@
1 1 <!DOCTYPE html>
2 2 <html>
3   -<head>
4   - <title>SampleApp</title>
5   - <%= stylesheet_link_tag :all %>
6   - <%= javascript_include_tag :defaults %>
7   - <%= csrf_meta_tag %>
8   -</head>
9   -<body>
10   -
11   -<%= yield %>
12   -
13   -</body>
  3 + <head>
  4 + <title>Ruby on Rails Tutorial Sample App | <%= @title %></title>
  5 + <%= csrf_meta_tag %>
  6 + </head>
  7 + <body>
  8 + <%= yield %>
  9 + </body>
14 10 </html>
  11 +
7 app/views/pages/about.html.erb
... ... @@ -0,0 +1,7 @@
  1 +<h1>About Us</h1>
  2 +<p>
  3 + <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
  4 + is a project to make a book and screencasts to teach web development
  5 + with <a href="http://rubyonrails.org/">Ruby on Rails</a>. This
  6 + is the sample application for the tutorial.
  7 +</p>
7 app/views/pages/contact.html.erb
... ... @@ -1,2 +1,5 @@
1   -<h1>Pages#contact</h1>
2   -<p>Find me in app/views/pages/contact.html.erb</p>
  1 +<h1>Contact</h1>
  2 +<p>
  3 + Contact Ruby on Rails Tutorial about the sample app at the
  4 + <a href="http://railstutorial.org/feedback">feedback page</a>.
  5 +</p>
8 app/views/pages/home.html.erb
... ... @@ -1,2 +1,6 @@
1   -<h1>Pages#home</h1>
2   -<p>Find me in app/views/pages/home.html.erb</p>
  1 +<h1>Sample App</h1>
  2 +<p>
  3 + This is the home page for the
  4 + <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
  5 + sample application.
  6 +</p>
16 bin/autospec
... ... @@ -0,0 +1,16 @@
  1 +#!/usr/bin/env ruby
  2 +#
  3 +# This file was generated by Bundler.
  4 +#
  5 +# The application 'autospec' is installed as part of a gem, and
  6 +# this file is here to facilitate running it.
  7 +#
  8 +
  9 +require 'pathname'
  10 +ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  11 + Pathname.new(__FILE__).realpath)
  12 +
  13 +require 'rubygems'
  14 +require 'bundler/setup'
  15 +
  16 +load Gem.bin_path('rspec-core', 'autospec')
16 bin/erubis
... ... @@ -0,0 +1,16 @@
  1 +#!/usr/bin/env ruby
  2 +#
  3 +# This file was generated by Bundler.
  4 +#
  5 +# The application 'erubis' is installed as part of a gem, and
  6 +# this file is here to facilitate running it.
  7 +#
  8 +
  9 +require 'pathname'
  10 +ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  11 + Pathname.new(__FILE__).realpath)
  12 +
  13 +require 'rubygems'
  14 +require 'bundler/setup'
  15 +
  16 +load Gem.bin_path('erubis', 'erubis')
16 bin/htmldiff
... ... @@ -0,0 +1,16 @@
  1 +#!/usr/bin/env ruby
  2 +#
  3 +# This file was generated by Bundler.
  4 +#
  5 +# The application 'htmldiff' is installed as part of a gem, and
  6 +# this file is here to facilitate running it.
  7 +#
  8 +
  9 +require 'pathname'
  10 +ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  11 + Pathname.new(__FILE__).realpath)
  12 +
  13 +require 'rubygems'
  14 +require 'bundler/setup'
  15 +
  16 +load Gem.bin_path('diff-lcs', 'htmldiff')
16 bin/ldiff
... ... @@ -0,0 +1,16 @@
  1 +#!/usr/bin/env ruby
  2 +#
  3 +# This file was generated by Bundler.
  4 +#
  5 +# The application 'ldiff' is installed as part of a gem, and
  6 +# this file is here to facilitate running it.
  7 +#
  8 +
  9 +require 'pathname'
  10 +ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  11 + Pathname.new(__FILE__).realpath)
  12 +
  13 +require 'rubygems'
  14 +require 'bundler/setup'
  15 +
  16 +load Gem.bin_path('diff-lcs', 'ldiff')
16 bin/nokogiri
... ... @@ -0,0 +1,16 @@
  1 +#!/usr/bin/env ruby
  2 +#
  3 +# This file was generated by Bundler.
  4 +#
  5 +# The application 'nokogiri' is installed as part of a gem, and
  6 +# this file is here to facilitate running it.
  7 +#
  8 +
  9 +require 'pathname'
  10 +ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  11 + Pathname.new(__FILE__).realpath)
  12 +
  13 +require 'rubygems'
  14 +require 'bundler/setup'
  15 +
  16 +load Gem.bin_path('nokogiri', 'nokogiri')
16 bin/rackup
... ... @@ -0,0 +1,16 @@
  1 +#!/usr/bin/env ruby
  2 +#
  3 +# This file was generated by Bundler.
  4 +#
  5 +# The application 'rackup' is installed as part of a gem, and
  6 +# this file is here to facilitate running it.
  7 +#
  8 +
  9 +require 'pathname'
  10 +ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  11 + Pathname.new(__FILE__).realpath)
  12 +
  13 +require 'rubygems'
  14 +require 'bundler/setup'
  15 +
  16 +load Gem.bin_path('rack', 'rackup')
16 bin/rails
... ... @@ -0,0 +1,16 @@
  1 +#!/usr/bin/env ruby
  2 +#
  3 +# This file was generated by Bundler.
  4 +#
  5 +# The application 'rails' is installed as part of a gem, and
  6 +# this file is here to facilitate running it.
  7 +#
  8 +
  9 +require 'pathname'
  10 +ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  11 + Pathname.new(__FILE__).realpath)
  12 +
  13 +require 'rubygems'
  14 +require 'bundler/setup'
  15 +
  16 +load Gem.bin_path('rails', 'rails')
16 bin/rake
... ... @@ -0,0 +1,16 @@
  1 +#!/usr/bin/env ruby
  2 +#
  3 +# This file was generated by Bundler.
  4 +#
  5 +# The application 'rake' is installed as part of a gem, and
  6 +# this file is here to facilitate running it.
  7 +#
  8 +
  9 +require 'pathname'
  10 +ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  11 + Pathname.new(__FILE__).realpath)
  12 +
  13 +require 'rubygems'
  14 +require 'bundler/setup'
  15 +
  16 +load Gem.bin_path('rake', 'rake')
16 bin/rake2thor
... ... @@ -0,0 +1,16 @@
  1 +#!/usr/bin/env ruby
  2 +#
  3 +# This file was generated by Bundler.
  4 +#
  5 +# The application 'rake2thor' is installed as part of a gem, and
  6 +# this file is here to facilitate running it.
  7 +#
  8 +
  9 +require 'pathname'
  10 +ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  11 + Pathname.new(__FILE__).realpath)
  12 +
  13 +require 'rubygems'
  14 +require 'bundler/setup'
  15 +
  16 +load Gem.bin_path('thor', 'rake2thor')
16 bin/rdoc
... ... @@ -0,0 +1,16 @@
  1 +#!/usr/bin/env ruby
  2 +#
  3 +# This file was generated by Bundler.
  4 +#
  5 +# The application 'rdoc' is installed as part of a gem, and
  6 +# this file is here to facilitate running it.
  7 +#
  8 +
  9 +require 'pathname'
  10 +ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  11 + Pathname.new(__FILE__).realpath)
  12 +
  13 +require 'rubygems'
  14 +require 'bundler/setup'
  15 +
  16 +load Gem.bin_path('rdoc', 'rdoc')
16 bin/ri
... ... @@ -0,0 +1,16 @@
  1 +#!/usr/bin/env ruby
  2 +#
  3 +# This file was generated by Bundler.
  4 +#
  5 +# The application 'ri' is installed as part of a gem, and
  6 +# this file is here to facilitate running it.
  7 +#
  8 +
  9 +require 'pathname'
  10 +ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  11 + Pathname.new(__FILE__).realpath)
  12 +
  13 +require 'rubygems'
  14 +require 'bundler/setup'
  15 +
  16 +load Gem.bin_path('rdoc', 'ri')
16 bin/rspec
... ... @@ -0,0 +1,16 @@
  1 +#!/usr/bin/env ruby
  2 +#
  3 +# This file was generated by Bundler.
  4 +#
  5 +# The application 'rspec' is installed as part of a gem, and
  6 +# this file is here to facilitate running it.
  7 +#
  8 +
  9 +require 'pathname'
  10 +ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  11 + Pathname.new(__FILE__).realpath)
  12 +
  13 +require 'rubygems'
  14 +require 'bundler/setup'
  15 +
  16 +load Gem.bin_path('rspec-core', 'rspec')
16 bin/spork
... ... @@ -0,0 +1,16 @@
  1 +#!/usr/bin/env ruby
  2 +#
  3 +# This file was generated by Bundler.
  4 +#
  5 +# The application 'spork' is installed as part of a gem, and
  6 +# this file is here to facilitate running it.
  7 +#
  8 +
  9 +require 'pathname'
  10 +ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  11 + Pathname.new(__FILE__).realpath)
  12 +
  13 +require 'rubygems'
  14 +require 'bundler/setup'
  15 +
  16 +load Gem.bin_path('spork', 'spork')
16 bin/thor
... ... @@ -0,0 +1,16 @@
  1 +#!/usr/bin/env ruby
  2 +#
  3 +# This file was generated by Bundler.
  4 +#
  5 +# The application 'thor' is installed as part of a gem, and
  6 +# this file is here to facilitate running it.
  7 +#
  8 +
  9 +require 'pathname'
  10 +ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  11 + Pathname.new(__FILE__).realpath)
  12 +
  13 +require 'rubygems'
  14 +require 'bundler/setup'
  15 +
  16 +load Gem.bin_path('thor', 'thor')
16 bin/tt
... ... @@ -0,0 +1,16 @@
  1 +#!/usr/bin/env ruby
  2 +#
  3 +# This file was generated by Bundler.
  4 +#
  5 +# The application 'tt' is installed as part of a gem, and
  6 +# this file is here to facilitate running it.
  7 +#
  8 +
  9 +require 'pathname'
  10 +ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
  11 + Pathname.new(__FILE__).realpath)
  12 +
  13 +require 'rubygems'
  14 +require 'bundler/setup'
  15 +
  16 +load Gem.bin_path('treetop', 'tt')
2  config/routes.rb
... ... @@ -1,7 +1,7 @@
1 1 SampleApp::Application.routes.draw do
2 2 get "pages/home"
3   -
4 3 get "pages/contact"
  4 + get "pages/about"
5 5
6 6 # The priority is based upon order of creation:
7 7 # first created -> highest priority.
10 spec/controllers/pages_controller_spec.rb
... ... @@ -1,11 +1,13 @@
1 1 require 'spec_helper'
2 2
3 3 describe PagesController do
  4 + render_views
4 5
5 6 describe "GET 'home'" do
6 7 it "should be successful" do
7 8 get 'home'
8 9 response.should be_success
  10 + response.should have_selector("title", :content=> " | Home")
9 11 end
10 12 end
11 13
@@ -13,7 +15,15 @@
13 15 it "should be successful" do
14 16 get 'contact'
15 17 response.should be_success
  18 + response.should have_selector("title", :content=> " | Contact")
16 19 end
17 20 end
18 21
  22 + describe "GET 'about'" do
  23 + it "should be successful" do
  24 + get 'about'
  25 + response.should be_success
  26 + response.should have_selector("title", :content=> " | About")
  27 + end
  28 + end
19 29 end
15 spec/helpers/pages_helper_spec.rb
... ... @@ -1,15 +0,0 @@
1   -require 'spec_helper'
2   -
3   -# Specs in this file have access to a helper object that includes
4   -# the PagesHelper. For example:
5   -#
6   -# describe PagesHelper do
7   -# describe "string concat" do
8   -# it "concats two strings with spaces" do
9   -# helper.concat_strings("this","that").should == "this that"
10   -# end
11   -# end
12   -# end
13   -describe PagesHelper do
14   - pending "add some examples to (or delete) #{__FILE__}"
15   -end
59 spec/spec_helper.rb
... ... @@ -1,3 +1,62 @@
  1 +require 'rubygems'
  2 +require 'spork'
  3 +
  4 +Spork.prefork do
  5 + # Loading more in this block will cause your tests to run faster. However,
  6 + # if you change any configuration or code from libraries loaded here, you'll
  7 + # need to restart spork for it take effect.
  8 + ENV["RAILS_ENV"] ||= 'test'
  9 + require File.expand_path("../../config/environment", __FILE__)
  10 + require 'rspec/rails'
  11 +
  12 + # Requires supporting files with custom materchers and macros, etc,
  13 + # # in ./support/ and it's subdirectories.
  14 + Dir[Rails.root.join("spec/support**/*.rb")].each {|f| require f}
  15 +
  16 + RSpec.configure do |config|
  17 + config.mock_with :rspec
  18 + config.fixture_path = "#{::Rails.root}/spec/fixtures"
  19 + config.use_transactional_fixtures = true
  20 + end
  21 +end
  22 +
  23 +Spork.each_run do
  24 + # This code will be run each time you run your specs.
  25 +
  26 +end
  27 +
  28 +# --- Instructions ---
  29 +# Sort the contents of this file into a Spork.prefork and a Spork.each_run
  30 +# block.
  31 +#
  32 +# The Spork.prefork block is run only once when the spork server is started.
  33 +# You typically want to place most of your (slow) initializer code in here, in
  34 +# particular, require'ing any 3rd-party gems that you don't normally modify
  35 +# during development.
  36 +#
  37 +# The Spork.each_run block is run each time you run your specs. In case you
  38 +# need to load files that tend to change during development, require them here.
  39 +# With Rails, your application modules are loaded automatically, so sometimes
  40 +# this block can remain empty.
  41 +#
  42 +# Note: You can modify files loaded *from* the Spork.each_run block without
  43 +# restarting the spork server. However, this file itself will not be reloaded,
  44 +# so if you change any of the code inside the each_run block, you still need to
  45 +# restart the server. In general, if you have non-trivial code in this file,
  46 +# it's advisable to move it into a separate file so you can easily edit it
  47 +# without restarting spork. (For example, with RSpec, you could move
  48 +# non-trivial code into a file spec/support/my_helper.rb, making sure that the
  49 +# spec/support/* files are require'd from inside the each_run block.)
  50 +#
  51 +# Any code that is left outside the two blocks will be run during preforking
  52 +# *and* during each_run -- that's probably not what you want.
  53 +#
  54 +# These instructions should self-destruct in 10 seconds. If they don't, feel
  55 +# free to delete them.
  56 +
  57 +
  58 +
  59 +
1 60 # This file is copied to spec/ when you run 'rails generate rspec:install'
2 61 ENV["RAILS_ENV"] ||= 'test'
3 62 require File.expand_path("../../config/environment", __FILE__)
5 spec/views/pages/contact.html.erb_spec.rb
... ... @@ -1,5 +0,0 @@
1   -require 'spec_helper'
2   -
3   -describe "pages/contact.html.erb" do
4   - pending "add some examples to (or delete) #{__FILE__}"
5   -end
5 spec/views/pages/home.html.erb_spec.rb
... ... @@ -1,5 +0,0 @@
1   -require 'spec_helper'
2   -
3   -describe "pages/home.html.erb" do
4   - pending "add some examples to (or delete) #{__FILE__}"
5   -end

0 comments on commit 3365917

Please sign in to comment.
Something went wrong with that request. Please try again.