I'm doing a Rails 3.2 Upgrade from Rails 2.3, and along with it going to new versions of gems like RSpec.
It's worth noting that my app is extremely large:
$ rake stats
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Total | 132568 | 96987 | 1108 | 7078 | 6 | 11 |
+----------------------+-------+-------+---------+---------+-----+-------+
Code LOC: 55656 Test LOC: 41331 Code to Test Ratio: 1:0.7
Day to day, I'm using zeus, which has the test environment booted in about 20 seconds, and takes about 40 minutes to run the build.
However if I run
$ rspec
It takes 4 minutes and 53 seconds just to get started, and then crawls from there.
My spec helper isn't doing anything crazy. THe only thing I've really removed is rspec/autorun, which is required to keep zeus from double-executing everything.
# spec_helper.rb
ENV["Rails.env"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/given'
require 'database_cleaner'
require 'capybara/rspec/matchers'
require 'debugger'
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
include FactoryGirl::Syntax::Methods
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.global_fixtures = :users, :roles
config.use_transactional_fixtures = false
config.infer_base_class_for_anonymous_controllers = false
config.order = "random"
def (ActionDispatch::Integration::Session).fixture_path
RSpec.configuration.fixture_path
end
end
EDIT: For the record, rake spec works just fine.