Using spork with watchr and all that jazz... though still not feeling like the tests are "blazingly fast" (sigh)

This commit is contained in:
Dan Buch 2011-11-14 08:35:09 -05:00
parent 99b84ea0c9
commit d727621c46
7 changed files with 49 additions and 31 deletions

View File

@ -1 +1 @@
--colour --colour --drb

View File

@ -36,5 +36,5 @@ group :development, :test do
gem 'rspec-rails' gem 'rspec-rails'
gem 'watchr' gem 'watchr'
gem 'rev' gem 'rev'
gem 'spork' gem 'spork', '~> 0.9.0.rc'
end end

View File

@ -105,6 +105,7 @@ GEM
sass (>= 3.1.4) sass (>= 3.1.4)
sprockets (~> 2.0.0) sprockets (~> 2.0.0)
tilt (~> 1.3.2) tilt (~> 1.3.2)
spork (0.9.0.rc9)
sprockets (2.0.3) sprockets (2.0.3)
hike (~> 1.2) hike (~> 1.2)
rack (~> 1.0) rack (~> 1.0)
@ -132,6 +133,7 @@ DEPENDENCIES
rev rev
rspec-rails rspec-rails
sass-rails (~> 3.1.4) sass-rails (~> 3.1.4)
spork (~> 0.9.0.rc)
sqlite3 sqlite3
uglifier (>= 1.0.3) uglifier (>= 1.0.3)
watchr watchr

View File

@ -1,3 +1,2 @@
class Person < ActiveRecord::Base class Person < ActiveRecord::Base
end end

View File

@ -50,5 +50,11 @@ module Gerbil
# Version of your assets, change this if you want to expire all your assets # Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0' config.assets.version = '1.0'
if Rails.env.test?
initializer :after => :initialize_dependency_mechanism do
ActiveSupport::Dependencies.mechanism = :load
end
end
end end
end end

View File

@ -5,7 +5,7 @@ Gerbil::Application.configure do
# test suite. You never need to work with it otherwise. Remember that # test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped # your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there! # and recreated between test runs. Don't rely on the data there!
config.cache_classes = true config.cache_classes = false
# Configure static asset server for tests with Cache-Control for performance # Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true config.serve_static_assets = true

View File

@ -1,33 +1,44 @@
# This file is copied to spec/ when you run 'rails generate rspec:install' require 'spork'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
# Requires supporting ruby files with custom matchers and macros, etc, Spork.prefork do
# in spec/support/ and its subdirectories. # This file is copied to spec/ when you run 'rails generate rspec:install'
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
RSpec.configure do |config| # Requires supporting ruby files with custom matchers and macros, etc,
# == Mock Framework # in spec/support/ and its subdirectories.
# Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
# 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
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures RSpec.configure do |config|
config.fixture_path = "#{::Rails.root}/spec/fixtures" # == 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
# If you're not using ActiveRecord, or you'd prefer not to run each of your # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
# examples within a transaction, remove the following line or assign false config.fixture_path = "#{::Rails.root}/spec/fixtures"
# instead of true.
config.use_transactional_fixtures = true
# If true, the base class of anonymous controllers will be inferred # If you're not using ActiveRecord, or you'd prefer not to run each of your
# automatically. This will be the default behavior in future versions of # examples within a transaction, remove the following line or assign false
# rspec-rails. # instead of true.
config.infer_base_class_for_anonymous_controllers = false config.use_transactional_fixtures = true
# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false
ActiveSupport::Dependencies.clear
end
end
Spork.each_run do
load Rails.root.join("config/routes.rb")
Dir[Rails.root.join("app/**/*.rb")].each { |f| load f }
end end