parallel_split_test 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock
CHANGED
@@ -6,15 +6,16 @@ require 'parallel_split_test/core_ext/rspec_example'
|
|
6
6
|
module ParallelSplitTest
|
7
7
|
class CommandLine < RSpec::Core::CommandLine
|
8
8
|
def run(err, out)
|
9
|
-
setup_copied_from_rspec(err, out)
|
10
9
|
processes = (ENV['PARALLEL_SPLIT_TEST_PROCESSES'] || Parallel.processor_count).to_i
|
11
10
|
|
12
11
|
Parallel.in_processes(processes) do |process_number|
|
12
|
+
ENV['TEST_ENV_NUMBER'] = (process_number == 0 ? '' : (process_number + 1).to_s)
|
13
|
+
setup_copied_from_rspec(err, out)
|
14
|
+
|
13
15
|
ParallelSplitTest.example_counter = 0
|
14
16
|
ParallelSplitTest.process_count = processes
|
15
17
|
ParallelSplitTest.process_number = process_number
|
16
18
|
|
17
|
-
ENV['TEST_ENV_NUMBER'] = (process_number == 0 ? '' : (process_number + 1).to_s)
|
18
19
|
run_group_of_tests(processes)
|
19
20
|
end
|
20
21
|
end
|
@@ -69,26 +69,19 @@ describe ParallelSplitTest do
|
|
69
69
|
write "xxx_spec.rb", <<-RUBY
|
70
70
|
describe "X" do
|
71
71
|
it "a" do
|
72
|
-
puts "it-ran-a-in-\#{ENV['TEST_ENV_NUMBER']
|
72
|
+
puts "it-ran-a-in-\#{ENV['TEST_ENV_NUMBER']}-"
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
76
|
describe "Y" do
|
77
77
|
it "b" do
|
78
|
-
puts "it-ran-b-in-\#{ENV['TEST_ENV_NUMBER']
|
78
|
+
puts "it-ran-b-in-\#{ENV['TEST_ENV_NUMBER']}-"
|
79
79
|
end
|
80
80
|
end
|
81
81
|
RUBY
|
82
82
|
result = parallel_split_test "xxx_spec.rb"
|
83
83
|
result.scan('1 example, 0 failures').size.should == 2
|
84
|
-
|
85
|
-
processes = ["a","b"].map do |process|
|
86
|
-
rex = /it-ran-#{process}-in-(\d)-/
|
87
|
-
result.should =~ rex
|
88
|
-
result.match(rex)[1]
|
89
|
-
end
|
90
|
-
|
91
|
-
processes.sort.should == ['0','2']
|
84
|
+
result.scan(/it-ran-.-in-.?-/).sort.should == ["it-ran-a-in--", "it-ran-b-in-2-"]
|
92
85
|
end
|
93
86
|
|
94
87
|
it "runs faster" do
|
@@ -119,6 +112,12 @@ describe ParallelSplitTest do
|
|
119
112
|
time{ result = parallel_split_test "xxx_spec.rb" }.should < 2
|
120
113
|
result.scan('1 example, 0 failures').size.should == 2
|
121
114
|
end
|
115
|
+
|
116
|
+
it "sets up TEST_ENV_NUMBER before loading the test files, so db connections are set up correctly" do
|
117
|
+
write "xxx_spec.rb", 'puts "ENV_IS_#{ENV[\'TEST_ENV_NUMBER\']}_"'
|
118
|
+
result = parallel_split_test "xxx_spec.rb"
|
119
|
+
result.scan(/ENV_IS_.?_/).sort.should == ["ENV_IS_2_", "ENV_IS__"]
|
120
|
+
end
|
122
121
|
end
|
123
122
|
end
|
124
123
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel_split_test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &71624760 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '2'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *71624760
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: parallel
|
27
|
-
requirement: &
|
27
|
+
requirement: &71624510 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 0.5.12
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *71624510
|
36
36
|
description:
|
37
37
|
email: michael@grosser.it
|
38
38
|
executables:
|
@@ -69,7 +69,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
69
69
|
version: '0'
|
70
70
|
segments:
|
71
71
|
- 0
|
72
|
-
hash:
|
72
|
+
hash: -426615473
|
73
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
78
|
version: '0'
|
79
79
|
segments:
|
80
80
|
- 0
|
81
|
-
hash:
|
81
|
+
hash: -426615473
|
82
82
|
requirements: []
|
83
83
|
rubyforge_project:
|
84
84
|
rubygems_version: 1.8.10
|