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

cat-town
Dan Buch 13 years ago
parent 99b84ea0c9
commit d727621c46

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

@ -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

@ -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

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

@ -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

@ -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

@ -1,3 +1,6 @@
require 'spork'
Spork.prefork do
# This file is copied to spec/ when you run 'rails generate rspec:install' # This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test' ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__) require File.expand_path("../../config/environment", __FILE__)
@ -30,4 +33,12 @@ RSpec.configure do |config|
# automatically. This will be the default behavior in future versions of # automatically. This will be the default behavior in future versions of
# rspec-rails. # rspec-rails.
config.infer_base_class_for_anonymous_controllers = false 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

Loading…
Cancel
Save