Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use spork

  • Loading branch information...
commit bbbe4b1ac4b98c69e9b0410c0172161b138f36b9 1 parent e56b808
@gabebw authored
Showing with 48 additions and 34 deletions.
  1. +48 −34 spec/spec_helper.rb
View
82 spec/spec_helper.rb
@@ -1,38 +1,52 @@
-# This file is copied to spec/ when you run 'rails generate rspec:install'
-ENV["RAILS_ENV"] ||= 'test'
-require File.expand_path("../../config/environment", __FILE__)
-require 'rspec/rails'
-require 'authlogic/test_case'
-include Authlogic::TestCase
-
-# Requires supporting ruby files with custom matchers and macros, etc,
-# in spec/support/ and its subdirectories.
-Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
-
-# Call activate_authlogic first.
-def login_user(user = Factory(:user))
- # Pass in a User object.
- UserSession.create(user)
-end
+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.
+
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
+ ENV["RAILS_ENV"] ||= 'test'
+ require File.expand_path("../../config/environment", __FILE__)
+ require 'rspec/rails'
+ require 'authlogic/test_case'
+ include Authlogic::TestCase
+
+ # Requires supporting ruby files with custom matchers and macros, etc,
+ # in spec/support/ and its subdirectories.
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
+
+ # Call activate_authlogic first.
+ def login_user(user = Factory(:user))
+ # Pass in a User object.
+ UserSession.create(user)
+ end
-def logout
- UserSession.find.destroy
+ def logout
+ UserSession.find.destroy
+ end
+
+ RSpec.configure do |config|
+ # == Mock Framework
+ #
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
+ #
+ # config.mock_with :mocha
+ # config.mock_with :flexmock
+ # config.mock_with :rr
+ config.mock_with :rspec
+
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
+
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
+ # examples within a transaction, comment the following line or assign false
+ # instead of true.
+ config.use_transactional_fixtures = true
+ end
end
-RSpec.configure do |config|
- # == Mock Framework
- #
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
- #
- # config.mock_with :mocha
- # config.mock_with :flexmock
- # config.mock_with :rr
- config.mock_with :rspec
-
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
-
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
- # examples within a transaction, comment the following line or assign false
- # instead of true.
- config.use_transactional_fixtures = true
+Spork.each_run do
+ # This code will be run each time you run your specs.
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.