Skip to content

Commit

Permalink
WIP: Enable parallel_spec
Browse files Browse the repository at this point in the history
wip:
* [ ] Update README

setup:

* bundle
* rake parallel:create (to setup test databases)

usage:
RAILS_ENV=test rake parallel:spec (without spring)
bin/parallel_rspec spec (with spring)

timing on my slow macbook:
> rake spec
Finished in 55.08 seconds (files took 6.85 seconds to load)
> RAILS_ENV=test rake parallel:spec
Took 47 seconds
  • Loading branch information
n-b committed May 5, 2020
1 parent 0c1cdb0 commit 6dcacb8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .rspec_parallel
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--format progress
--format ParallelTests::RSpec::RuntimeLogger --out tmp/parallel_runtime_rspec.log
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ group :development, :test do
gem 'faker'
gem 'rspec-rails'
gem 'rspec_junit_formatter', require: false
gem 'parallel_tests'
gem 'spring-commands-parallel-tests'
gem "dotenv-rails"
gem "debase"
end
Expand Down
6 changes: 6 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ GEM
mini_portile2 (~> 2.4.0)
orm_adapter (0.5.0)
parallel (1.19.1)
parallel_tests (2.32.0)
parallel
parser (2.7.1.0)
ast (~> 2.4.0)
pg (1.2.3)
Expand Down Expand Up @@ -447,6 +449,8 @@ GEM
shoulda-matchers (4.3.0)
activesupport (>= 4.2.0)
spring (2.1.0)
spring-commands-parallel-tests (1.0.1)
spring (>= 0.9.1)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
spring-watcher-listen (2.0.1)
Expand Down Expand Up @@ -545,6 +549,7 @@ DEPENDENCIES
listen
mailjet
metamagic
parallel_tests
pg
premailer-rails
puma
Expand All @@ -567,6 +572,7 @@ DEPENDENCIES
sentry-raven
shoulda-matchers
spring
spring-commands-parallel-tests
spring-commands-rspec
spring-watcher-listen
therubyracer
Expand Down
8 changes: 8 additions & 0 deletions bin/parallel_rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env ruby
begin
load File.expand_path('spring', __dir__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
require 'bundler/setup'
load Gem.bin_path('parallel_tests', 'parallel_rspec')
4 changes: 2 additions & 2 deletions bin/spring
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env ruby

# This file loads spring without using Bundler, in order to be fast.
# This file loads Spring without using Bundler, in order to be fast.
# It gets overwritten when you run the `spring binstub` command.

unless defined?(Spring)
require 'rubygems'
require 'bundler'

lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
spring = lockfile.specs.detect { |spec| spec.name == "spring" }
spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
if spring
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
gem 'spring', spring.version
Expand Down

0 comments on commit 6dcacb8

Please sign in to comment.