parallelized_specs 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Rakefile +2 -2
- data/Readme.md +32 -65
- data/VERSION +1 -1
- data/bin/parallelized_spec +2 -0
- data/bin/{parallel_test → parallelized_test} +6 -7
- data/lib/{parallel_specs.rb → parallelized_specs.rb} +4 -4
- data/lib/{parallel_specs → parallelized_specs}/spec_error_count_logger.rb +2 -2
- data/lib/{parallel_specs → parallelized_specs}/spec_error_logger.rb +2 -2
- data/lib/{parallel_specs → parallelized_specs}/spec_failures_logger.rb +3 -3
- data/lib/{parallel_specs → parallelized_specs}/spec_logger_base.rb +3 -3
- data/lib/{parallel_specs → parallelized_specs}/spec_runtime_logger.rb +1 -1
- data/lib/{parallel_specs → parallelized_specs}/spec_start_finish_logger.rb +2 -2
- data/lib/{parallel_specs → parallelized_specs}/spec_summary_logger.rb +2 -2
- data/lib/{parallel_tests.rb → parallelized_tests.rb} +4 -4
- data/lib/{parallel_tests → parallelized_tests}/grouper.rb +1 -1
- data/lib/{parallel_tests → parallelized_tests}/railtie.rb +2 -2
- data/lib/{parallel_tests → parallelized_tests}/runtime_logger.rb +4 -4
- data/lib/{parallel_tests → parallelized_tests}/tasks.rb +4 -4
- data/lib/tasks/parallelized_tests.rake +1 -0
- data/parallelized_specs.gemspec +26 -26
- data/spec/integration_spec.rb +3 -4
- data/spec/{parallel_specs → parallelized_specs}/spec_failure_logger_spec.rb +8 -8
- data/spec/{parallel_specs → parallelized_specs}/spec_runtime_logger_spec.rb +4 -4
- data/spec/{parallel_specs → parallelized_specs}/spec_summary_logger_spec.rb +2 -2
- data/spec/parallelized_specs_spec.rb +165 -0
- data/spec/{parallel_tests → parallelized_tests}/runtime_logger_spec.rb +13 -13
- data/spec/{parallel_tests_spec.rb → parallelized_tests_spec.rb} +39 -39
- data/spec/spec_helper.rb +1 -1
- metadata +29 -29
- data/bin/parallel_spec +0 -2
- data/lib/tasks/parallel_tests.rake +0 -1
- data/spec/parallel_specs_spec.rb +0 -165
@@ -1,80 +1,80 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
test_tests_in_groups(
|
3
|
+
describe ParallelizedTests do
|
4
|
+
test_tests_in_groups(ParallelizedTests, 'test', '_test.rb')
|
5
5
|
|
6
6
|
describe :parse_rake_args do
|
7
7
|
it "should return the count" do
|
8
8
|
args = {:count => 2}
|
9
|
-
|
9
|
+
ParallelizedTests.parse_rake_args(args).should == [2, '', ""]
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should default to the prefix" do
|
13
13
|
args = {:count => "models"}
|
14
|
-
|
14
|
+
ParallelizedTests.parse_rake_args(args).should == [Parallel.processor_count, "models", ""]
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should return the count and pattern" do
|
18
18
|
args = {:count => 2, :pattern => "models"}
|
19
|
-
|
19
|
+
ParallelizedTests.parse_rake_args(args).should == [2, "models", ""]
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should return the count, pattern, and options" do
|
23
23
|
args = {:count => 2, :pattern => "plain", :options => "-p default" }
|
24
|
-
|
24
|
+
ParallelizedTests.parse_rake_args(args).should == [2, "plain", "-p default"]
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should use the PARALLEL_TEST_PROCESSORS env var for processor_count if set" do
|
28
28
|
ENV['PARALLEL_TEST_PROCESSORS'] = '28'
|
29
|
-
|
29
|
+
ParallelizedTests.parse_rake_args({}).should == [28, '', '']
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should use count over PARALLEL_TEST_PROCESSORS env var" do
|
33
33
|
ENV['PARALLEL_TEST_PROCESSORS'] = '28'
|
34
34
|
args = {:count => 2}
|
35
|
-
|
35
|
+
ParallelizedTests.parse_rake_args(args).should == [2, '', ""]
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
describe :run_tests do
|
40
40
|
it "uses TEST_ENV_NUMBER=blank when called for process 0" do
|
41
|
-
|
42
|
-
|
41
|
+
ParallelizedTests.should_receive(:open).with{|x,y|x=~/TEST_ENV_NUMBER= /}.and_return mocked_process
|
42
|
+
ParallelizedTests.run_tests(['xxx'],0,{})
|
43
43
|
end
|
44
44
|
|
45
45
|
it "uses TEST_ENV_NUMBER=2 when called for process 1" do
|
46
|
-
|
47
|
-
|
46
|
+
ParallelizedTests.should_receive(:open).with{|x,y| x=~/TEST_ENV_NUMBER=2/}.and_return mocked_process
|
47
|
+
ParallelizedTests.run_tests(['xxx'],1,{})
|
48
48
|
end
|
49
49
|
|
50
50
|
it "uses options" do
|
51
|
-
|
52
|
-
|
51
|
+
ParallelizedTests.should_receive(:open).with{|x,y| x=~ %r{ruby -Itest .* -- -v}}.and_return mocked_process
|
52
|
+
ParallelizedTests.run_tests(['xxx'],1,:test_options => '-v')
|
53
53
|
end
|
54
54
|
|
55
55
|
it "returns the output" do
|
56
56
|
io = open('spec/spec_helper.rb')
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
ParallelizedTests.stub!(:print)
|
58
|
+
ParallelizedTests.should_receive(:open).and_return io
|
59
|
+
ParallelizedTests.run_tests(['xxx'],1,{})[:stdout].should =~ /\$LOAD_PATH << File/
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
describe :test_in_groups do
|
64
64
|
it "does not sort when passed false do_sort option" do
|
65
|
-
|
66
|
-
|
65
|
+
ParallelizedTests.should_not_receive(:smallest_first)
|
66
|
+
ParallelizedTests.tests_in_groups [], 1, :no_sort => true
|
67
67
|
end
|
68
68
|
|
69
69
|
it "does sort when not passed do_sort option" do
|
70
|
-
|
71
|
-
|
72
|
-
|
70
|
+
ParallelizedTests.stub!(:tests_with_runtime).and_return([])
|
71
|
+
ParallelizedTests::Grouper.should_receive(:largest_first).and_return([])
|
72
|
+
ParallelizedTests.tests_in_groups [], 1
|
73
73
|
end
|
74
74
|
|
75
75
|
it "groups by single_process pattern and then via size" do
|
76
|
-
|
77
|
-
result =
|
76
|
+
ParallelizedTests.should_receive(:with_runtime_info).and_return([['aaa',5],['aaa2',5],['bbb',2],['ccc',1],['ddd',1]])
|
77
|
+
result = ParallelizedTests.tests_in_groups [], 3, :single_process => [/^a.a/]
|
78
78
|
result.should == [["aaa", "aaa2"], ["bbb"], ["ccc", "ddd"]]
|
79
79
|
end
|
80
80
|
end
|
@@ -97,7 +97,7 @@ Finished in 0.145069 seconds.
|
|
97
97
|
|
98
98
|
EOF
|
99
99
|
|
100
|
-
|
100
|
+
ParallelizedTests.find_results(output).should == ['10 tests, 20 assertions, 0 failures, 0 errors','14 tests, 20 assertions, 0 failures, 0 errors']
|
101
101
|
end
|
102
102
|
|
103
103
|
it "is robust against scrambled output" do
|
@@ -116,7 +116,7 @@ Finished in 0.145069 seconds.
|
|
116
116
|
14 te.dsts, 20 assertions, 0 failures, 0 errors
|
117
117
|
EOF
|
118
118
|
|
119
|
-
|
119
|
+
ParallelizedTests.find_results(output).should == ['10 tests, 20 assertions, 0 failures, 0 errors','14 tedsts, 20 assertions, 0 failures, 0 errors']
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
@@ -127,35 +127,35 @@ EOF
|
|
127
127
|
|
128
128
|
it "should return false" do
|
129
129
|
use_temporary_directory_for do
|
130
|
-
|
130
|
+
ParallelizedTests.send(:bundler_enabled?).should == false
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
134
|
it "should return true when there is a constant called Bundler" do
|
135
135
|
use_temporary_directory_for do
|
136
136
|
Object.stub!(:const_defined?).with(:Bundler).and_return true
|
137
|
-
|
137
|
+
ParallelizedTests.send(:bundler_enabled?).should == true
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
141
|
it "should be true when there is a Gemfile" do
|
142
142
|
use_temporary_directory_for do
|
143
143
|
FileUtils.touch("Gemfile")
|
144
|
-
|
144
|
+
ParallelizedTests.send(:bundler_enabled?).should == true
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
148
|
it "should be true when there is a Gemfile in the parent directory" do
|
149
149
|
use_temporary_directory_for do
|
150
150
|
FileUtils.touch(File.join("..", "Gemfile"))
|
151
|
-
|
151
|
+
ParallelizedTests.send(:bundler_enabled?).should == true
|
152
152
|
end
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
156
156
|
describe :find_tests do
|
157
157
|
it "returns if root is an array" do
|
158
|
-
|
158
|
+
ParallelizedTests.send(:find_tests, [1]).should == [1]
|
159
159
|
end
|
160
160
|
|
161
161
|
it "finds all test files" do
|
@@ -171,7 +171,7 @@ EOF
|
|
171
171
|
`touch #{root}/b/test.rb`
|
172
172
|
`ln -s #{root}/b #{root}/c`
|
173
173
|
`ln -s #{root}/b #{root}/a/`
|
174
|
-
|
174
|
+
ParallelizedTests.send(:find_tests, root).sort.should == [
|
175
175
|
"#{root}/a/b/y_test.rb",
|
176
176
|
"#{root}/a/x_test.rb",
|
177
177
|
"#{root}/b/y_test.rb",
|
@@ -191,7 +191,7 @@ EOF
|
|
191
191
|
`touch #{root}/a/x_test.rb`
|
192
192
|
`touch #{root}/a/y_test.rb`
|
193
193
|
`touch #{root}/a/z_test.rb`
|
194
|
-
|
194
|
+
ParallelizedTests.send(:find_tests, root, :pattern => '^a/(y|z)_test').sort.should == [
|
195
195
|
"#{root}/a/y_test.rb",
|
196
196
|
"#{root}/a/z_test.rb",
|
197
197
|
]
|
@@ -203,27 +203,27 @@ EOF
|
|
203
203
|
|
204
204
|
describe :summarize_results do
|
205
205
|
it "adds results" do
|
206
|
-
|
206
|
+
ParallelizedTests.summarize_results(['1 foo 3 bar','2 foo 5 bar']).should == '8 bars, 3 foos'
|
207
207
|
end
|
208
208
|
|
209
209
|
it "adds results with braces" do
|
210
|
-
|
210
|
+
ParallelizedTests.summarize_results(['1 foo(s) 3 bar(s)','2 foo 5 bar']).should == '8 bars, 3 foos'
|
211
211
|
end
|
212
212
|
|
213
213
|
it "adds same results with plurals" do
|
214
|
-
|
214
|
+
ParallelizedTests.summarize_results(['1 foo 3 bar','2 foos 5 bar']).should == '8 bars, 3 foos'
|
215
215
|
end
|
216
216
|
|
217
217
|
it "adds non-similar results" do
|
218
|
-
|
218
|
+
ParallelizedTests.summarize_results(['1 xxx 2 yyy','1 xxx 2 zzz']).should == '2 xxxs, 2 yyys, 2 zzzs'
|
219
219
|
end
|
220
220
|
|
221
221
|
it "does not pluralize 1" do
|
222
|
-
|
222
|
+
ParallelizedTests.summarize_results(['1 xxx 2 yyy']).should == '1 xxx, 2 yyys'
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
226
226
|
it "has a version" do
|
227
|
-
|
227
|
+
ParallelizedTests::VERSION.should =~ /^\d+\.\d+\.\d+$/
|
228
228
|
end
|
229
229
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,7 +5,7 @@ require 'rubygems'
|
|
5
5
|
FAKE_RAILS_ROOT = '/tmp/pspecs/fixtures'
|
6
6
|
|
7
7
|
require 'tempfile'
|
8
|
-
require '
|
8
|
+
require 'parallelized_specs'
|
9
9
|
require 'parallel_specs/spec_runtime_logger'
|
10
10
|
require 'parallel_specs/spec_summary_logger'
|
11
11
|
require 'parallel_cucumber'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallelized_specs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jake Sorce, Bryan Madsen
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-04-
|
18
|
+
date: 2012-04-18 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: parallel
|
@@ -34,8 +34,8 @@ dependencies:
|
|
34
34
|
description:
|
35
35
|
email: jake@instructure.com
|
36
36
|
executables:
|
37
|
-
-
|
38
|
-
-
|
37
|
+
- parallelized_spec
|
38
|
+
- parallelized_test
|
39
39
|
extensions: []
|
40
40
|
|
41
41
|
extra_rdoc_files: []
|
@@ -46,32 +46,32 @@ files:
|
|
46
46
|
- Rakefile
|
47
47
|
- Readme.md
|
48
48
|
- VERSION
|
49
|
-
- bin/
|
50
|
-
- bin/
|
51
|
-
- lib/
|
52
|
-
- lib/
|
53
|
-
- lib/
|
54
|
-
- lib/
|
55
|
-
- lib/
|
56
|
-
- lib/
|
57
|
-
- lib/
|
58
|
-
- lib/
|
59
|
-
- lib/
|
60
|
-
- lib/
|
61
|
-
- lib/
|
62
|
-
- lib/
|
63
|
-
- lib/
|
64
|
-
- lib/tasks/
|
49
|
+
- bin/parallelized_spec
|
50
|
+
- bin/parallelized_test
|
51
|
+
- lib/parallelized_specs.rb
|
52
|
+
- lib/parallelized_specs/spec_error_count_logger.rb
|
53
|
+
- lib/parallelized_specs/spec_error_logger.rb
|
54
|
+
- lib/parallelized_specs/spec_failures_logger.rb
|
55
|
+
- lib/parallelized_specs/spec_logger_base.rb
|
56
|
+
- lib/parallelized_specs/spec_runtime_logger.rb
|
57
|
+
- lib/parallelized_specs/spec_start_finish_logger.rb
|
58
|
+
- lib/parallelized_specs/spec_summary_logger.rb
|
59
|
+
- lib/parallelized_tests.rb
|
60
|
+
- lib/parallelized_tests/grouper.rb
|
61
|
+
- lib/parallelized_tests/railtie.rb
|
62
|
+
- lib/parallelized_tests/runtime_logger.rb
|
63
|
+
- lib/parallelized_tests/tasks.rb
|
64
|
+
- lib/tasks/parallelized_tests.rake
|
65
65
|
- parallelized_specs.gemspec
|
66
66
|
- spec/integration_spec.rb
|
67
|
-
- spec/
|
68
|
-
- spec/
|
69
|
-
- spec/
|
70
|
-
- spec/
|
71
|
-
- spec/
|
72
|
-
- spec/
|
67
|
+
- spec/parallelized_specs/spec_failure_logger_spec.rb
|
68
|
+
- spec/parallelized_specs/spec_runtime_logger_spec.rb
|
69
|
+
- spec/parallelized_specs/spec_summary_logger_spec.rb
|
70
|
+
- spec/parallelized_specs_spec.rb
|
71
|
+
- spec/parallelized_tests/runtime_logger_spec.rb
|
72
|
+
- spec/parallelized_tests_spec.rb
|
73
73
|
- spec/spec_helper.rb
|
74
|
-
homepage: http://github.com/
|
74
|
+
homepage: http://github.com/jakesorce/parallelized_specs
|
75
75
|
licenses: []
|
76
76
|
|
77
77
|
post_install_message:
|
data/bin/parallel_spec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "/../parallel_tests/tasks")
|
data/spec/parallel_specs_spec.rb
DELETED
@@ -1,165 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'parallel_specs/spec_runtime_logger'
|
3
|
-
require 'parallel_specs/spec_summary_logger'
|
4
|
-
require 'parallel_specs/spec_failures_logger'
|
5
|
-
|
6
|
-
describe ParallelSpecs do
|
7
|
-
test_tests_in_groups(ParallelSpecs, 'spec', '_spec.rb')
|
8
|
-
|
9
|
-
describe :run_tests do
|
10
|
-
before do
|
11
|
-
File.stub!(:file?).with('script/spec').and_return false
|
12
|
-
File.stub!(:file?).with('spec/spec.opts').and_return false
|
13
|
-
File.stub!(:file?).with('spec/parallel_spec.opts').and_return false
|
14
|
-
ParallelSpecs.stub!(:bundler_enabled?).and_return false
|
15
|
-
end
|
16
|
-
|
17
|
-
it "uses TEST_ENV_NUMBER=blank when called for process 0" do
|
18
|
-
ParallelSpecs.should_receive(:open).with{|x,y|x=~/TEST_ENV_NUMBER= /}.and_return mocked_process
|
19
|
-
ParallelSpecs.run_tests(['xxx'],0,{})
|
20
|
-
end
|
21
|
-
|
22
|
-
it "uses TEST_ENV_NUMBER=2 when called for process 1" do
|
23
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x=~/TEST_ENV_NUMBER=2/}.and_return mocked_process
|
24
|
-
ParallelSpecs.run_tests(['xxx'],1,{})
|
25
|
-
end
|
26
|
-
|
27
|
-
it "runs with color when called from cmdline" do
|
28
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x=~/ --tty /}.and_return mocked_process
|
29
|
-
$stdout.should_receive(:tty?).and_return true
|
30
|
-
ParallelSpecs.run_tests(['xxx'],1,{})
|
31
|
-
end
|
32
|
-
|
33
|
-
it "runs without color when not called from cmdline" do
|
34
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x !~ / --tty /}.and_return mocked_process
|
35
|
-
$stdout.should_receive(:tty?).and_return false
|
36
|
-
ParallelSpecs.run_tests(['xxx'],1,{})
|
37
|
-
end
|
38
|
-
|
39
|
-
it "runs with color for rspec 1 when called for the cmdline" do
|
40
|
-
File.should_receive(:file?).with('script/spec').and_return true
|
41
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x=~/ RSPEC_COLOR=1 /}.and_return mocked_process
|
42
|
-
$stdout.should_receive(:tty?).and_return true
|
43
|
-
ParallelSpecs.run_tests(['xxx'],1,{})
|
44
|
-
end
|
45
|
-
|
46
|
-
it "runs without color for rspec 1 when not called for the cmdline" do
|
47
|
-
File.should_receive(:file?).with('script/spec').and_return true
|
48
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x !~ / RSPEC_COLOR=1 /}.and_return mocked_process
|
49
|
-
$stdout.should_receive(:tty?).and_return false
|
50
|
-
ParallelSpecs.run_tests(['xxx'],1,{})
|
51
|
-
end
|
52
|
-
|
53
|
-
it "run bundle exec spec when on bundler rspec 1" do
|
54
|
-
File.stub!(:file?).with('script/spec').and_return false
|
55
|
-
ParallelSpecs.stub!(:bundler_enabled?).and_return true
|
56
|
-
ParallelSpecs.stub!(:run).with("bundle show rspec").and_return "/foo/bar/rspec-1.0.2"
|
57
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{bundle exec spec}}.and_return mocked_process
|
58
|
-
ParallelSpecs.run_tests(['xxx'],1,{})
|
59
|
-
end
|
60
|
-
|
61
|
-
it "run bundle exec rspec when on bundler rspec 2" do
|
62
|
-
File.stub!(:file?).with('script/spec').and_return false
|
63
|
-
ParallelSpecs.stub!(:bundler_enabled?).and_return true
|
64
|
-
ParallelSpecs.stub!(:run).with("bundle show rspec").and_return "/foo/bar/rspec-2.0.2"
|
65
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{bundle exec rspec}}.and_return mocked_process
|
66
|
-
ParallelSpecs.run_tests(['xxx'],1,{})
|
67
|
-
end
|
68
|
-
|
69
|
-
it "runs script/spec when script/spec can be found" do
|
70
|
-
File.should_receive(:file?).with('script/spec').and_return true
|
71
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{script/spec}}.and_return mocked_process
|
72
|
-
ParallelSpecs.run_tests(['xxx'],1,{})
|
73
|
-
end
|
74
|
-
|
75
|
-
it "runs spec when script/spec cannot be found" do
|
76
|
-
File.stub!(:file?).with('script/spec').and_return false
|
77
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x !~ %r{script/spec}}.and_return mocked_process
|
78
|
-
ParallelSpecs.run_tests(['xxx'],1,{})
|
79
|
-
end
|
80
|
-
|
81
|
-
it "uses no -O when no opts where found" do
|
82
|
-
File.stub!(:file?).with('spec/spec.opts').and_return false
|
83
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x !~ %r{spec/spec.opts}}.and_return mocked_process
|
84
|
-
ParallelSpecs.run_tests(['xxx'],1,{})
|
85
|
-
end
|
86
|
-
|
87
|
-
it "uses -O spec/spec.opts when found (with script/spec)" do
|
88
|
-
File.stub!(:file?).with('script/spec').and_return true
|
89
|
-
File.stub!(:file?).with('spec/spec.opts').and_return true
|
90
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{script/spec\s+ -O spec/spec.opts}}.and_return mocked_process
|
91
|
-
ParallelSpecs.run_tests(['xxx'],1,{})
|
92
|
-
end
|
93
|
-
|
94
|
-
it "uses -O spec/parallel_spec.opts when found (with script/spec)" do
|
95
|
-
File.stub!(:file?).with('script/spec').and_return true
|
96
|
-
File.should_receive(:file?).with('spec/parallel_spec.opts').and_return true
|
97
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{script/spec\s+ -O spec/parallel_spec.opts}}.and_return mocked_process
|
98
|
-
ParallelSpecs.run_tests(['xxx'],1,{})
|
99
|
-
end
|
100
|
-
|
101
|
-
it "uses -O spec/parallel_spec.opts with rspec1" do
|
102
|
-
File.should_receive(:file?).with('spec/parallel_spec.opts').and_return true
|
103
|
-
|
104
|
-
ParallelSpecs.stub!(:bundler_enabled?).and_return true
|
105
|
-
ParallelSpecs.stub!(:run).with("bundle show rspec").and_return "/foo/bar/rspec-1.0.2"
|
106
|
-
|
107
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{spec\s+ -O spec/parallel_spec.opts}}.and_return mocked_process
|
108
|
-
ParallelSpecs.run_tests(['xxx'],1,{})
|
109
|
-
end
|
110
|
-
|
111
|
-
it "uses -O spec/parallel_spec.opts with rspec2" do
|
112
|
-
File.should_receive(:file?).with('spec/parallel_spec.opts').and_return true
|
113
|
-
|
114
|
-
ParallelSpecs.stub!(:bundler_enabled?).and_return true
|
115
|
-
ParallelSpecs.stub!(:run).with("bundle show rspec").and_return "/foo/bar/rspec-2.4.2"
|
116
|
-
|
117
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{rspec\s+ --color --tty -O spec/parallel_spec.opts}}.and_return mocked_process
|
118
|
-
ParallelSpecs.run_tests(['xxx'],1,{})
|
119
|
-
end
|
120
|
-
|
121
|
-
it "uses options passed in" do
|
122
|
-
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{rspec -f n}}.and_return mocked_process
|
123
|
-
ParallelSpecs.run_tests(['xxx'],1, :test_options => '-f n')
|
124
|
-
end
|
125
|
-
|
126
|
-
it "returns the output" do
|
127
|
-
io = open('spec/spec_helper.rb')
|
128
|
-
ParallelSpecs.stub!(:print)
|
129
|
-
ParallelSpecs.should_receive(:open).and_return io
|
130
|
-
ParallelSpecs.run_tests(['xxx'],1,{})[:stdout].should =~ /\$LOAD_PATH << File/
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
describe :find_results do
|
135
|
-
it "finds multiple results in spec output" do
|
136
|
-
output = <<EOF
|
137
|
-
....F...
|
138
|
-
..
|
139
|
-
failute fsddsfsd
|
140
|
-
...
|
141
|
-
ff.**..
|
142
|
-
0 examples, 0 failures, 0 pending
|
143
|
-
ff.**..
|
144
|
-
1 example, 1 failure, 1 pending
|
145
|
-
EOF
|
146
|
-
|
147
|
-
ParallelSpecs.find_results(output).should == ['0 examples, 0 failures, 0 pending','1 example, 1 failure, 1 pending']
|
148
|
-
end
|
149
|
-
|
150
|
-
it "is robust against scrambeled output" do
|
151
|
-
output = <<EOF
|
152
|
-
....F...
|
153
|
-
..
|
154
|
-
failute fsddsfsd
|
155
|
-
...
|
156
|
-
ff.**..
|
157
|
-
0 exFampl*es, 0 failures, 0 pend.ing
|
158
|
-
ff.**..
|
159
|
-
1 exampF.les, 1 failures, 1 pend.ing
|
160
|
-
EOF
|
161
|
-
|
162
|
-
ParallelSpecs.find_results(output).should == ['0 examples, 0 failures, 0 pending','1 examples, 1 failures, 1 pending']
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|