This gem implements the parallel_rspec
command for
Spring.
This is a fork of the spring-commands-rspec gem to suppor the parallel_rspec
command from the parallel_tests gem.
This gem also patches Spring to reload the database configuration and reconnect the database, which allows you to use <%= ENV['TEST_ENV_NUMBER'] %>
in database.yml
:
require 'spring/application'
class Spring::Application
alias connect_database_orig connect_database
def connect_database
disconnect_database
reconfigure_database
connect_database_orig
end
def reconfigure_database
if active_record_configured?
ActiveRecord::Base.configurations =
Rails.application.config.database_configuration
end
end
end
Add to your Gemfile:
gem 'spring-commands-parallel-rspec', group: :development
If you're using spring binstubs, run bundle exec spring binstub parallel_rspec
to generate bin/parallel_rspec
.
Then run spring stop
to pick up the changes.