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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 773680cd7ac7cc86421fc4511597b488293aa9b0
4
- data.tar.gz: 420dff9c171a05bf34e3013c8cb8c0aed377bf0e
3
+ metadata.gz: d64dc85017a3e37989dc7622f31efbf66dc2f5db
4
+ data.tar.gz: e7be200563e7b4c7bce5219fca0f51aaeee868fb
5
5
  SHA512:
6
- metadata.gz: 5b347907242eed08bc9edef8f2d59f221519d74d9f30ff6fa8fdb81edac1c7cdfc1df2b1c38566a20aa6a137618909a5a6c539d6f7c5d9ff6dcb92760c8815be
7
- data.tar.gz: cbe1cf67c4deab173e1668dae741f555d8b930872a558f08d6d3d71925d06d0c4c38f2f1d5266f2d8cc8a0af8e02c05ba10f0768e39fa493cbf81e1a604f57df
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).
@@ -4,5 +4,6 @@ require "parallel_rspec/workers"
4
4
  require "parallel_rspec/example"
5
5
  require "parallel_rspec/server"
6
6
  require "parallel_rspec/client"
7
+ require "parallel_rspec/rake_task"
7
8
  require "parallel_rspec/runner"
8
9
  require "parallel_rspec/railtie"
@@ -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
@@ -0,0 +1,10 @@
1
+ require 'rspec/core/rake_task'
2
+
3
+ module ParallelRSpec
4
+ class RakeTask < RSpec::Core::RakeTask
5
+ def initialize(*args, &task_block)
6
+ super
7
+ self.rspec_path = File.expand_path('../../../exe/prspec', __FILE__)
8
+ end
9
+ end
10
+ 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
@@ -1,3 +1,3 @@
1
1
  module ParallelRSpec
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  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::Base.configurations['test']['database'] << worker.to_s unless worker == 1
60
- ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
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.1
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: 2015-09-27 00:00:00.000000000 Z
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.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