Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 9 files changed
  • 0 comments
  • 1 contributor
1  .rspec
... ... @@ -1 +1,2 @@
1 1 --colour
  2 +--drb
9 Gemfile
@@ -4,11 +4,9 @@ gem 'rails', '3.2.5'
4 4
5 5 group :development do
6 6 gem 'heroku', '2.26.6'
7   -end
8   -
9   -group :development, :test do
10 7 gem 'sqlite3', '1.3.6'
11 8 gem 'rspec-rails', '2.10.1'
  9 + gem 'guard-rspec', '1.0.0'
12 10 end
13 11
14 12 # Gems used only for assets and not required
@@ -22,7 +20,12 @@ end
22 20 gem 'jquery-rails', '2.0.2'
23 21
24 22 group :test do
  23 + gem 'rspec-rails', '2.10.1'
25 24 gem 'capybara', '1.1.2'
  25 + gem 'rb-fsevent', '0.9.1', :require => false
  26 + gem 'growl', '1.0.3'
  27 + gem 'guard-spork', '1.0.0'
  28 + gem 'spork', '0.9.2'
26 29 end
27 30
28 31 group :production do
24 Gemfile.lock
@@ -53,6 +53,15 @@ GEM
53 53 execjs (1.4.0)
54 54 multi_json (~> 1.0)
55 55 ffi (1.0.11)
  56 + growl (1.0.3)
  57 + guard (1.1.1)
  58 + listen (>= 0.4.2)
  59 + thor (>= 0.14.6)
  60 + guard-rspec (1.0.0)
  61 + guard (>= 1.1)
  62 + guard-spork (1.0.0)
  63 + guard (>= 1.0.0)
  64 + spork (>= 0.8.4)
56 65 heroku (2.26.6)
57 66 heroku-api (~> 0.2.4)
58 67 launchy (>= 0.3.2)
@@ -72,6 +81,10 @@ GEM
72 81 addressable (~> 2.2.6)
73 82 libwebsocket (0.1.3)
74 83 addressable
  84 + listen (0.4.2)
  85 + rb-fchange (~> 0.0.5)
  86 + rb-fsevent (~> 0.9.1)
  87 + rb-inotify (~> 0.8.8)
75 88 mail (2.4.4)
76 89 i18n (>= 0.4.0)
77 90 mime-types (~> 1.16)
@@ -105,6 +118,11 @@ GEM
105 118 rdoc (~> 3.4)
106 119 thor (>= 0.14.6, < 2.0)
107 120 rake (0.9.2.2)
  121 + rb-fchange (0.0.5)
  122 + ffi
  123 + rb-fsevent (0.9.1)
  124 + rb-inotify (0.8.8)
  125 + ffi (>= 0.5.0)
108 126 rdoc (3.12)
109 127 json (~> 1.4)
110 128 rest-client (1.6.7)
@@ -134,6 +152,7 @@ GEM
134 152 libwebsocket (~> 0.1.3)
135 153 multi_json (~> 1.0)
136 154 rubyzip
  155 + spork (0.9.2)
137 156 sprockets (2.1.3)
138 157 hike (~> 1.2)
139 158 rack (~> 1.0)
@@ -157,11 +176,16 @@ PLATFORMS
157 176 DEPENDENCIES
158 177 capybara (= 1.1.2)
159 178 coffee-rails (= 3.2.2)
  179 + growl (= 1.0.3)
  180 + guard-rspec (= 1.0.0)
  181 + guard-spork (= 1.0.0)
160 182 heroku (= 2.26.6)
161 183 jquery-rails (= 2.0.2)
162 184 pg (= 0.13.2)
163 185 rails (= 3.2.5)
  186 + rb-fsevent (= 0.9.1)
164 187 rspec-rails (= 2.10.1)
165 188 sass-rails (= 3.2.5)
  189 + spork (= 0.9.2)
166 190 sqlite3 (= 1.3.6)
167 191 uglifier (= 1.2.4)
27 Guardfile
... ... @@ -0,0 +1,27 @@
  1 +guard 'spork', :rspec_env => { 'RAILS_ENV' => 'test' } do
  2 + watch('config/application.rb')
  3 + watch('config/environment.rb')
  4 + watch(%r{^config/environments/.+\.rb$})
  5 + watch(%r{^config/initializers/.+\.rb$})
  6 + watch('Gemfile')
  7 + watch('Gemfile.lock')
  8 + watch('spec/spec_helper.rb') { :rspec }
  9 + watch('test/test_helper.rb') { :test_unit }
  10 + watch(%r{features/support/}) { :cucumber }
  11 +end
  12 +
  13 +guard 'rspec', :version => 2, :all_after_pass => false, :cli => '--drb' do
  14 + watch(%r{^spec/.+_spec\.rb$})
  15 + watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
  16 + watch('spec/spec_helper.rb') { "spec" }
  17 +
  18 + # Rails example
  19 + watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
  20 + watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
  21 + watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
  22 + watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
  23 + watch('config/routes.rb') { "spec/routing" }
  24 + watch('app/controllers/application_controller.rb') { "spec/controllers" }
  25 + # Capybara request specs
  26 + watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
  27 +end
3  app/controllers/static_pages_controller.rb
@@ -7,4 +7,7 @@ def help
7 7
8 8 def about
9 9 end
  10 +
  11 + def contact
  12 + end
10 13 end
6 app/views/static_pages/contact.html.erb
... ... @@ -0,0 +1,6 @@
  1 +<% provide(:title, 'Contact') %>
  2 +<h1>Contact</h1>
  3 +<p>
  4 + Contact Ruby on Rails Tutorial about the sample app at the
  5 + <a href="http://railstutorial.org/contact">contact page</a>.
  6 +</p>
1  config/routes.rb
@@ -2,4 +2,5 @@
2 2 get "static_pages/home"
3 3 get "static_pages/help"
4 4 get "static_pages/about"
  5 + get "static_pages/contact"
5 6 end
25 spec/requests/static_pages_spec.rb
@@ -2,6 +2,8 @@
2 2
3 3 describe "Static pages" do
4 4
  5 + let(:base_title) { "Ruby on Rails Tutorial Sample App" }
  6 +
5 7 describe "Home page" do
6 8
7 9 it "should have the h1 'Sample App'" do
@@ -11,8 +13,7 @@
11 13
12 14 it "should have the title 'Home'" do
13 15 visit '/static_pages/home'
14   - page.should have_selector('title',
15   - :text => "Ruby on Rails Tutorial Sample App | Home")
  16 + page.should have_selector('title', :text => "#{base_title} | Home")
16 17 end
17 18 end
18 19
@@ -25,8 +26,7 @@
25 26
26 27 it "should have the title 'Help'" do
27 28 visit '/static_pages/help'
28   - page.should have_selector('title',
29   - :text => "Ruby on Rails Tutorial Sample App | Help")
  29 + page.should have_selector('title', :text => "#{base_title} | Help")
30 30 end
31 31 end
32 32
@@ -39,9 +39,20 @@
39 39
40 40 it "should have the title 'About Us'" do
41 41 visit '/static_pages/about'
42   - page.should have_selector('title',
43   - :text => "Ruby on Rails Tutorial Sample App | About Us")
  42 + page.should have_selector('title', :text => "#{base_title} | About Us")
  43 + end
  44 + end
  45 +
  46 + describe "Contact page" do
  47 +
  48 + it "should have the h1 'Contact'" do
  49 + visit '/static_pages/contact'
  50 + page.should have_selector('h1', :text => 'Contact')
  51 + end
  52 +
  53 + it "should have the title 'Contact'" do
  54 + visit '/static_pages/contact'
  55 + page.should have_selector('title', :text => "#{base_title} | Contact")
44 56 end
45 57 end
46   -
47 58 end
49 spec/spec_helper.rb
... ... @@ -1,3 +1,52 @@
  1 +require 'rubygems'
  2 +require 'spork'
  3 +#uncomment the following line to use spork with the debugger
  4 +#require 'spork/ext/ruby-debug'
  5 +
  6 +Spork.prefork do
  7 + # Loading more in this block will cause your tests to run faster. However,
  8 + # if you change any configuration or code from libraries loaded here, you'll
  9 + # need to restart spork for it take effect.
  10 +
  11 +end
  12 +
  13 +Spork.each_run do
  14 + # This code will be run each time you run your specs.
  15 +
  16 +end
  17 +
  18 +# --- Instructions ---
  19 +# Sort the contents of this file into a Spork.prefork and a Spork.each_run
  20 +# block.
  21 +#
  22 +# The Spork.prefork block is run only once when the spork server is started.
  23 +# You typically want to place most of your (slow) initializer code in here, in
  24 +# particular, require'ing any 3rd-party gems that you don't normally modify
  25 +# during development.
  26 +#
  27 +# The Spork.each_run block is run each time you run your specs. In case you
  28 +# need to load files that tend to change during development, require them here.
  29 +# With Rails, your application modules are loaded automatically, so sometimes
  30 +# this block can remain empty.
  31 +#
  32 +# Note: You can modify files loaded *from* the Spork.each_run block without
  33 +# restarting the spork server. However, this file itself will not be reloaded,
  34 +# so if you change any of the code inside the each_run block, you still need to
  35 +# restart the server. In general, if you have non-trivial code in this file,
  36 +# it's advisable to move it into a separate file so you can easily edit it
  37 +# without restarting spork. (For example, with RSpec, you could move
  38 +# non-trivial code into a file spec/support/my_helper.rb, making sure that the
  39 +# spec/support/* files are require'd from inside the each_run block.)
  40 +#
  41 +# Any code that is left outside the two blocks will be run during preforking
  42 +# *and* during each_run -- that's probably not what you want.
  43 +#
  44 +# These instructions should self-destruct in 10 seconds. If they don't, feel
  45 +# free to delete them.
  46 +
  47 +
  48 +
  49 +
1 50 # This file is copied to spec/ when you run 'rails generate rspec:install'
2 51 ENV["RAILS_ENV"] ||= 'test'
3 52 require File.expand_path("../../config/environment", __FILE__)

No commit comments for this range

Something went wrong with that request. Please try again.