minitest-parallel_fork 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/MIT-LICENSE +1 -1
- data/README.rdoc +14 -0
- data/lib/minitest/parallel_fork.rb +1 -1
- data/spec/minitest_parallel_fork_example.rb +12 -0
- data/spec/minitest_parallel_fork_spec.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42f6c6919472888f0ad2799def6d83c39bf69ab6
|
4
|
+
data.tar.gz: e4fe5385b3e8682001470c2c6891bc8eadb49696
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 007440c55981f82d53333b49efc3ca47609eed8ad9e7601fb215b125cabe4b8d809181a97b4f467e3f87a97373907dc169401de53f8b547711c9408f67842536
|
7
|
+
data.tar.gz: 80d30b6fde62eaec6ca63ab203890a19a564243677b7bc9fa5ca01ac56a741c95f79b3dfb484d6b8abb52c2a64b35e7b1a2bb6e546a2dba94bf3ff0a434e8f2b
|
data/CHANGELOG
CHANGED
data/MIT-LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -59,6 +59,20 @@ disconnecting, and after forking, the database name is changed in each child to
|
|
59
59
|
a child-specific database, so that the child processes do not share a database and are
|
60
60
|
thus independent.
|
61
61
|
|
62
|
+
== ActiveRecord
|
63
|
+
|
64
|
+
To use this with Rails/ActiveRecord, you probably want to use hooks similar to:
|
65
|
+
|
66
|
+
Minitest.before_parallel_fork do
|
67
|
+
ActiveRecord::Base.connection.disconnect!
|
68
|
+
end
|
69
|
+
|
70
|
+
Minitest.after_parallel_fork do |i|
|
71
|
+
db_config = Rails.application.config.database_configuration[Rails.env].clone
|
72
|
+
db_config['database'] += (i+1).to_s
|
73
|
+
ActiveRecord::Base.establish_connection(db_config)
|
74
|
+
end
|
75
|
+
|
62
76
|
= Speedup
|
63
77
|
|
64
78
|
The speedup you get greatly depends on your specs. Here's some examples using Sequel's
|
@@ -91,7 +91,7 @@ module Minitest
|
|
91
91
|
stat_reporter.assertions += assertions
|
92
92
|
results.map! do |name, failures|
|
93
93
|
runnable = Test.new(name)
|
94
|
-
runnable.failures.concat(failures)
|
94
|
+
runnable.failures.concat(failures.map{|f| f.is_a?(DumpableUnexpectedError) ? UnexpectedError.new(f) : f})
|
95
95
|
runnable
|
96
96
|
end
|
97
97
|
stat_reporter.results.concat(results)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-parallel_fork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|