Permalink
Browse files

get spork setup

  • Loading branch information...
1 parent 3316164 commit dd4574086712d882ad3d3da27737367611670d25 @coreyhaines committed Oct 28, 2011
Showing with 76 additions and 44 deletions.
  1. +1 −0 Gemfile
  2. +2 −0 Gemfile.lock
  3. +73 −44 features/support/env.rb
View
1 Gemfile
@@ -16,6 +16,7 @@ group :development, :test do
gem 'cucumber'
gem 'cucumber-rails'
gem 'database_cleaner'
+ gem 'spork'
end
# Gems used only for assets and not required
View
2 Gemfile.lock
@@ -134,6 +134,7 @@ GEM
ffi (= 1.0.9)
json_pure
rubyzip
+ spork (0.8.5)
sprockets (2.0.3)
hike (~> 1.2)
rack (~> 1.0)
@@ -166,5 +167,6 @@ DEPENDENCIES
rspec
rspec-rails
sass-rails (~> 3.1.4)
+ spork
sqlite3
uglifier (>= 1.0.3)
View
117 features/support/env.rb
@@ -1,50 +1,79 @@
-# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
-# It is recommended to regenerate this file in the future when you upgrade to a
-# newer version of cucumber-rails. Consider adding your own code to a new file
-# instead of editing this one. Cucumber will automatically load all features/**/*.rb
-# files.
+require 'rubygems'
+require 'spork'
-require 'cucumber/rails'
+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.
-# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
-# order to ease the transition to Capybara we set the default here. If you'd
-# prefer to use XPath just remove this line and adjust any selectors in your
-# steps to use the XPath syntax.
-Capybara.default_selector = :css
+ require 'cucumber/rails'
-# By default, any exception happening in your Rails application will bubble up
-# to Cucumber so that your scenario will fail. This is a different from how
-# your application behaves in the production environment, where an error page will
-# be rendered instead.
-#
-# Sometimes we want to override this default behaviour and allow Rails to rescue
-# exceptions and display an error page (just like when the app is running in production).
-# Typical scenarios where you want to do this is when you test your error pages.
-# There are two ways to allow Rails to rescue exceptions:
-#
-# 1) Tag your scenario (or feature) with @allow-rescue
-#
-# 2) Set the value below to true. Beware that doing this globally is not
-# recommended as it will mask a lot of errors for you!
-#
-ActionController::Base.allow_rescue = false
-
-# Remove/comment out the lines below if your app doesn't have a database.
-# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
-begin
- DatabaseCleaner.strategy = :transaction
-rescue NameError
- raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
+ # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
+ # order to ease the transition to Capybara we set the default here. If you'd
+ # prefer to use XPath just remove this line and adjust any selectors in your
+ # steps to use the XPath syntax.
+ Capybara.default_selector = :css
+
+ # By default, any exception happening in your Rails application will bubble up
+ # to Cucumber so that your scenario will fail. This is a different from how
+ # your application behaves in the production environment, where an error page will
+ # be rendered instead.
+ #
+ # Sometimes we want to override this default behaviour and allow Rails to rescue
+ # exceptions and display an error page (just like when the app is running in production).
+ # Typical scenarios where you want to do this is when you test your error pages.
+ # There are two ways to allow Rails to rescue exceptions:
+ #
+ # 1) Tag your scenario (or feature) with @allow-rescue
+ #
+ # 2) Set the value below to true. Beware that doing this globally is not
+ # recommended as it will mask a lot of errors for you!
+ #
+ ActionController::Base.allow_rescue = false
+
+ # Remove/comment out the lines below if your app doesn't have a database.
+ # For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
+ begin
+ DatabaseCleaner.strategy = :transaction
+ rescue NameError
+ raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
+ end
+
+ # You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
+ # See the DatabaseCleaner documentation for details. Example:
+ #
+ # Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
+ # DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]}
+ # end
+ #
+ # Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
+ # DatabaseCleaner.strategy = :transaction
+ # end
+ #
end
-# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
-# See the DatabaseCleaner documentation for details. Example:
-#
-# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
-# DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]}
-# end
-#
-# Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
-# DatabaseCleaner.strategy = :transaction
-# end
+Spork.each_run do
+ # This code will be run each time you run your specs.
+
+end
+
+# --- Instructions ---
+# - Sort through your spec_helper file. Place as much environment loading
+# code that you don't normally modify during development in the
+# Spork.prefork block.
+# - Place the rest under Spork.each_run block
+# - Any code that is left outside of the blocks will be ran during preforking
+# and during each_run!
+# - These instructions should self-destruct in 10 seconds. If they don't,
+# feel free to delete them.
#
+
+
+
+
+# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
+# It is recommended to regenerate this file in the future when you upgrade to a
+# newer version of cucumber-rails. Consider adding your own code to a new file
+# instead of editing this one. Cucumber will automatically load all features/**/*.rb
+# files.
+

0 comments on commit dd45740

Please sign in to comment.