parallel_tests 0.4.12 → 0.4.13
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.
- data/VERSION +1 -1
- data/lib/parallel_specs.rb +18 -14
- data/parallel_tests.gemspec +2 -2
- data/spec/parallel_specs_spec.rb +20 -6
- metadata +7 -7
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.13
|
data/lib/parallel_specs.rb
CHANGED
@@ -2,8 +2,9 @@ require File.join(File.dirname(__FILE__), 'parallel_tests')
|
|
2
2
|
|
3
3
|
class ParallelSpecs < ParallelTests
|
4
4
|
def self.run_tests(test_files, process_number, options)
|
5
|
-
exe = executable #
|
6
|
-
|
5
|
+
exe = executable # expensive, so we cache
|
6
|
+
version = (exe =~ /\brspec\b/ ? 2 : 1)
|
7
|
+
cmd = "#{rspec_1_color if version == 1}#{exe} #{options} #{rspec_2_color if version == 2}#{spec_opts(version)} #{test_files*' '}"
|
7
8
|
execute_command(cmd, process_number)
|
8
9
|
end
|
9
10
|
|
@@ -26,20 +27,23 @@ class ParallelSpecs < ParallelTests
|
|
26
27
|
`#{cmd}`
|
27
28
|
end
|
28
29
|
|
29
|
-
def self.
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
else
|
36
|
-
"-O #{opts}"
|
37
|
-
end
|
30
|
+
def self.rspec_1_color
|
31
|
+
'RSPEC_COLOR=1 ; export RSPEC_COLOR ;' if $stdout.tty?
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.rspec_2_color
|
35
|
+
'--tty ' if $stdout.tty?
|
38
36
|
end
|
39
37
|
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
def self.spec_opts(rspec_version)
|
39
|
+
options_file = ['spec/parallel_spec.opts', 'spec/spec.opts'].detect{|f| File.file?(f) }
|
40
|
+
return unless options_file
|
41
|
+
if rspec_version == 2
|
42
|
+
# does not handle -O, so we inline the options
|
43
|
+
File.read(options_file).tr("\n", ' ')
|
44
|
+
else
|
45
|
+
"-O #{options_file}"
|
46
|
+
end
|
43
47
|
end
|
44
48
|
|
45
49
|
def self.test_suffix
|
data/parallel_tests.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{parallel_tests}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.13"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Grosser"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-04-17}
|
13
13
|
s.email = %q{grosser.michael@gmail.com}
|
14
14
|
s.executables = ["parallel_spec", "parallel_cucumber", "parallel_test"]
|
15
15
|
s.files = [
|
data/spec/parallel_specs_spec.rb
CHANGED
@@ -22,13 +22,27 @@ describe ParallelSpecs do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it "runs with color when called from cmdline" do
|
25
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x=~/
|
25
|
+
ParallelSpecs.should_receive(:open).with{|x,y| x=~/ --tty /}.and_return mocked_process
|
26
26
|
$stdout.should_receive(:tty?).and_return true
|
27
27
|
ParallelSpecs.run_tests(['xxx'],1,'')
|
28
28
|
end
|
29
29
|
|
30
30
|
it "runs without color when not called from cmdline" do
|
31
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x !~ /
|
31
|
+
ParallelSpecs.should_receive(:open).with{|x,y| x !~ / --tty /}.and_return mocked_process
|
32
|
+
$stdout.should_receive(:tty?).and_return false
|
33
|
+
ParallelSpecs.run_tests(['xxx'],1,'')
|
34
|
+
end
|
35
|
+
|
36
|
+
it "runs with color for rspec 1 when called for the cmdline" do
|
37
|
+
File.should_receive(:file?).with('script/spec').and_return true
|
38
|
+
ParallelSpecs.should_receive(:open).with{|x,y| x=~/ RSPEC_COLOR=1 /}.and_return mocked_process
|
39
|
+
$stdout.should_receive(:tty?).and_return true
|
40
|
+
ParallelSpecs.run_tests(['xxx'],1,'')
|
41
|
+
end
|
42
|
+
|
43
|
+
it "runs without color for rspec 1 when not called for the cmdline" do
|
44
|
+
File.should_receive(:file?).with('script/spec').and_return true
|
45
|
+
ParallelSpecs.should_receive(:open).with{|x,y| x !~ / RSPEC_COLOR=1 /}.and_return mocked_process
|
32
46
|
$stdout.should_receive(:tty?).and_return false
|
33
47
|
ParallelSpecs.run_tests(['xxx'],1,'')
|
34
48
|
end
|
@@ -70,14 +84,14 @@ describe ParallelSpecs do
|
|
70
84
|
it "uses -O spec/spec.opts when found (with script/spec)" do
|
71
85
|
File.stub!(:file?).with('script/spec').and_return true
|
72
86
|
File.stub!(:file?).with('spec/spec.opts').and_return true
|
73
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{script/spec\s
|
87
|
+
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{script/spec\s+ -O spec/spec.opts}}.and_return mocked_process
|
74
88
|
ParallelSpecs.run_tests(['xxx'],1,'')
|
75
89
|
end
|
76
90
|
|
77
91
|
it "uses -O spec/parallel_spec.opts when found (with script/spec)" do
|
78
92
|
File.stub!(:file?).with('script/spec').and_return true
|
79
93
|
File.should_receive(:file?).with('spec/parallel_spec.opts').and_return true
|
80
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{script/spec\s
|
94
|
+
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{script/spec\s+ -O spec/parallel_spec.opts}}.and_return mocked_process
|
81
95
|
ParallelSpecs.run_tests(['xxx'],1,'')
|
82
96
|
end
|
83
97
|
|
@@ -98,7 +112,7 @@ describe ParallelSpecs do
|
|
98
112
|
ParallelSpecs.stub!(:bundler_enabled?).and_return true
|
99
113
|
ParallelSpecs.stub!(:run).with("bundle show rspec").and_return "/foo/bar/rspec-2.0.2"
|
100
114
|
|
101
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{rspec\s+ --foo --bar}}.and_return mocked_process
|
115
|
+
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{rspec\s+ --tty --foo --bar}}.and_return mocked_process
|
102
116
|
ParallelSpecs.run_tests(['xxx'],1,'')
|
103
117
|
end
|
104
118
|
|
@@ -146,4 +160,4 @@ EOF
|
|
146
160
|
ParallelSpecs.find_results(output).should == ['0 examples, 0 failures, 0 pending','1 examples, 1 failures, 1 pending']
|
147
161
|
end
|
148
162
|
end
|
149
|
-
end
|
163
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel_tests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 13
|
10
|
+
version: 0.4.13
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Grosser
|
@@ -15,11 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-04-17 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
23
|
none: false
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
@@ -28,10 +28,10 @@ dependencies:
|
|
28
28
|
segments:
|
29
29
|
- 0
|
30
30
|
version: "0"
|
31
|
-
prerelease: false
|
32
|
-
version_requirements: *id001
|
33
31
|
type: :runtime
|
32
|
+
requirement: *id001
|
34
33
|
name: parallel
|
34
|
+
prerelease: false
|
35
35
|
description:
|
36
36
|
email: grosser.michael@gmail.com
|
37
37
|
executables:
|