parallel_rspec 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -1
- data/lib/parallel_rspec.rb +1 -0
- data/lib/parallel_rspec/client.rb +4 -0
- data/lib/parallel_rspec/rake_task.rb +10 -0
- data/lib/parallel_rspec/server.rb +4 -0
- data/lib/parallel_rspec/version.rb +1 -1
- data/lib/parallel_rspec/workers.rb +4 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d64dc85017a3e37989dc7622f31efbf66dc2f5db
|
4
|
+
data.tar.gz: e7be200563e7b4c7bce5219fca0f51aaeee868fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bda496ce03c066b1f0c72c7b880921d5f39b6d5863337673c8e47422395fccf3bef08bc418892ad052867d73a7575719cf94878ba8a5347540ef00bc0fd396ac
|
7
|
+
data.tar.gz: e842d8a1b930b4ab6f39aa6c86c4c581b480aa1ca53ab42c6fa33a7756107054ff10b61f68e3d820c8bef79e14252f2ce59c062327e2b8d79f6b8044f5bfd620
|
data/README.md
CHANGED
@@ -34,7 +34,7 @@ By default, ParallelRSpec will use two workers. If you would like to use more,
|
|
34
34
|
|
35
35
|
ParallelRSpec runs each worker with its own copy of the test database to avoid locking and deadlocking problems. To create these and populate them with your schema, run:
|
36
36
|
|
37
|
-
$ bundle exec db:parallel:create db:parallel:prepare
|
37
|
+
$ bundle exec rake db:parallel:create db:parallel:prepare
|
38
38
|
|
39
39
|
ParallelRSpec will automatically make the database name for each worker based on the name you used for the `test` environment in `config/database.yml`. For example, if your normal `test` database is `foo_test`, worker 1 will keep using `foo_test` but worker 2's database will be `foo_test2`.
|
40
40
|
|
@@ -53,11 +53,27 @@ You may like to make an alias:
|
|
53
53
|
|
54
54
|
When you change WORKERS, don't forget to restart Spring and re-run the create and populate steps above if necessary.
|
55
55
|
|
56
|
+
To set up a rake task which uses parallel_rspec, use, for example:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
ParallelRSpec::RakeTask.new(:prspec) do |t|
|
60
|
+
ENV['WORKERS'] = '4'
|
61
|
+
t.pattern = "**/spec/*_spec.rb"
|
62
|
+
t.rspec_opts = "--tag parallel"
|
63
|
+
# etc...
|
64
|
+
end
|
65
|
+
```
|
66
|
+
|
56
67
|
## Contributing
|
57
68
|
|
58
69
|
Bug reports and pull requests are welcome on GitHub at https://github.com/willbryant/parallel_rspec.
|
59
70
|
|
60
71
|
|
72
|
+
## Thanks
|
73
|
+
|
74
|
+
* Charles Horn (@hornc)
|
75
|
+
|
76
|
+
|
61
77
|
## License
|
62
78
|
|
63
79
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/lib/parallel_rspec.rb
CHANGED
@@ -26,6 +26,10 @@ module ParallelRSpec
|
|
26
26
|
channel_to_server.write([:example_failed, serialize_example(example)])
|
27
27
|
end
|
28
28
|
|
29
|
+
def example_finished(example)
|
30
|
+
channel_to_server.write([:example_finished, serialize_example(example)])
|
31
|
+
end
|
32
|
+
|
29
33
|
def example_pending(example)
|
30
34
|
channel_to_server.write([:example_pending, serialize_example(example)])
|
31
35
|
end
|
@@ -22,6 +22,10 @@ module ParallelRSpec
|
|
22
22
|
reporter.example_failed(example)
|
23
23
|
end
|
24
24
|
|
25
|
+
def example_finished(example, channel_to_client)
|
26
|
+
reporter.example_finished(example)
|
27
|
+
end
|
28
|
+
|
25
29
|
def example_pending(example, channel_to_client)
|
26
30
|
reporter.example_pending(example)
|
27
31
|
end
|
@@ -56,8 +56,10 @@ module ParallelRSpec
|
|
56
56
|
|
57
57
|
def establish_test_database_connection(worker)
|
58
58
|
ENV['TEST_ENV_NUMBER'] = worker.to_s
|
59
|
-
ActiveRecord
|
60
|
-
|
59
|
+
if defined?(ActiveRecord)
|
60
|
+
ActiveRecord::Base.configurations['test']['database'] << worker.to_s unless worker == 1
|
61
|
+
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
|
62
|
+
end
|
61
63
|
end
|
62
64
|
|
63
65
|
def verify_children(child_pids)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel_rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Will Bryant, Powershop New Zealand Ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- lib/parallel_rspec/client.rb
|
61
61
|
- lib/parallel_rspec/example.rb
|
62
62
|
- lib/parallel_rspec/railtie.rb
|
63
|
+
- lib/parallel_rspec/rake_task.rb
|
63
64
|
- lib/parallel_rspec/runner.rb
|
64
65
|
- lib/parallel_rspec/server.rb
|
65
66
|
- lib/parallel_rspec/tasks.rake
|
@@ -86,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
87
|
version: '0'
|
87
88
|
requirements: []
|
88
89
|
rubyforge_project:
|
89
|
-
rubygems_version: 2.2.
|
90
|
+
rubygems_version: 2.2.5
|
90
91
|
signing_key:
|
91
92
|
specification_version: 4
|
92
93
|
summary: This gem lets you run your RSpec examples in parallel across across your
|