parallel_tests 0.4.7 → 0.4.8

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'rake'
4
+ gem 'rspec', '~>2'
5
+ gem 'parallel'
6
+ gem 'jeweler'
data/Gemfile.lock ADDED
@@ -0,0 +1,34 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.2)
5
+ gemcutter (0.6.1)
6
+ git (1.2.5)
7
+ jeweler (1.4.0)
8
+ gemcutter (>= 0.1.0)
9
+ git (>= 1.2.5)
10
+ rubyforge (>= 2.0.0)
11
+ json_pure (1.4.6)
12
+ parallel (0.5.1)
13
+ rake (0.8.7)
14
+ rspec (2.0.1)
15
+ rspec-core (~> 2.0.1)
16
+ rspec-expectations (~> 2.0.1)
17
+ rspec-mocks (~> 2.0.1)
18
+ rspec-core (2.0.1)
19
+ rspec-expectations (2.0.1)
20
+ diff-lcs (>= 1.1.2)
21
+ rspec-mocks (2.0.1)
22
+ rspec-core (~> 2.0.1)
23
+ rspec-expectations (~> 2.0.1)
24
+ rubyforge (2.0.4)
25
+ json_pure (>= 1.1.7)
26
+
27
+ PLATFORMS
28
+ ruby
29
+
30
+ DEPENDENCIES
31
+ jeweler
32
+ parallel
33
+ rake
34
+ rspec (~> 2)
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
1
  task :default => :spec
2
- require 'spec/rake/spectask'
3
- Spec::Rake::SpecTask.new {|t| t.spec_opts = ['--color --backtrace']}
2
+ require "rspec/core/rake_task"
3
+ RSpec::Core::RakeTask.new(:spec) do |t|
4
+ t.rspec_opts = '--backtrace --color'
5
+ end
4
6
 
5
7
  begin
6
8
  require 'jeweler'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.7
1
+ 0.4.8
@@ -2,7 +2,8 @@ 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
- cmd = "#{color} #{executable} #{options} #{spec_opts} #{test_files*' '}"
5
+ exe = executable # its expensive with bundler, so do not call it twice
6
+ cmd = "#{color} #{exe} #{options} #{spec_opts(exe)} #{test_files*' '}"
6
7
  execute_command(cmd, process_number)[:stdout]
7
8
  end
8
9
 
@@ -25,9 +26,15 @@ class ParallelSpecs < ParallelTests
25
26
  `#{cmd}`
26
27
  end
27
28
 
28
- def self.spec_opts
29
+ def self.spec_opts(executable)
29
30
  opts = ['spec/parallel_spec.opts', 'spec/spec.opts'].detect{|f| File.file?(f) }
30
- opts ? "-O #{opts}" : nil
31
+ return unless opts
32
+ if executable =~ /\brspec\b/
33
+ # RSpec2 does not handle -O, so we inline the options
34
+ File.read(opts).tr("\n", ' ')
35
+ else
36
+ "-O #{opts}"
37
+ end
31
38
  end
32
39
 
33
40
  #display color when we are in a terminal
@@ -5,15 +5,17 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{parallel_tests}
8
- s.version = "0.4.7"
8
+ s.version = "0.4.8"
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{2010-09-24}
12
+ s.date = %q{2010-11-23}
13
13
  s.email = %q{grosser.michael@gmail.com}
14
14
  s.executables = ["parallel_spec", "parallel_cucumber", "parallel_test"]
15
15
  s.files = [
16
16
  ".gitignore",
17
+ "Gemfile",
18
+ "Gemfile.lock",
17
19
  "Rakefile",
18
20
  "Readme.md",
19
21
  "VERSION",
@@ -38,7 +40,7 @@ Gem::Specification.new do |s|
38
40
  s.homepage = %q{http://github.com/grosser/parallel_tests}
39
41
  s.rdoc_options = ["--charset=UTF-8"]
40
42
  s.require_paths = ["lib"]
41
- s.rubygems_version = %q{1.3.6}
43
+ s.rubygems_version = %q{1.3.7}
42
44
  s.summary = %q{Run tests / specs / features in parallel}
43
45
  s.test_files = [
44
46
  "spec/parallel_cucumber_spec.rb",
@@ -52,7 +54,7 @@ Gem::Specification.new do |s|
52
54
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
53
55
  s.specification_version = 3
54
56
 
55
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
57
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
56
58
  s.add_runtime_dependency(%q<parallel>, [">= 0"])
57
59
  else
58
60
  s.add_dependency(%q<parallel>, [">= 0"])
@@ -106,6 +106,6 @@ describe 'CLI' do
106
106
  write "x1_spec.rb", ""
107
107
  write "x2_spec.rb", ""
108
108
  result = run_specs(:add => "--test-options ' --version'", :processes => 2)
109
- result.should =~ /rspec \d+\.\d+\.\d+.*rspec \d+\.\d+\.\d+/m # prints version twice
109
+ result.should =~ /\d+\.\d+\.\d+.*\d+\.\d+\.\d+/m # prints version twice
110
110
  end
111
111
  end
@@ -1,10 +1,11 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
1
+ require 'spec/spec_helper'
2
2
 
3
3
  describe ParallelCucumber do
4
4
  test_tests_in_groups(ParallelCucumber, 'features', ".feature")
5
5
 
6
6
  describe :run_tests do
7
- before(:each) do
7
+ before do
8
+ ParallelCucumber.stub!(:bundler_enabled?).and_return false
8
9
  File.stub!(:file?).with('.bundle/environment.rb').and_return false
9
10
  File.stub!(:file?).with('script/cucumber').and_return true
10
11
  end
@@ -1,14 +1,14 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
1
+ require 'spec/spec_helper'
2
2
 
3
3
  describe ParallelSpecs do
4
4
  test_tests_in_groups(ParallelSpecs, 'spec', '_spec.rb')
5
5
 
6
6
  describe :run_tests do
7
7
  before do
8
- File.stub!(:file?).with('.bundle/environment.rb').and_return false
9
- File.stub!(:file?).with('script/spec').and_return true
10
- File.stub!(:file?).with('spec/spec.opts').and_return true
8
+ File.stub!(:file?).with('script/spec').and_return false
9
+ File.stub!(:file?).with('spec/spec.opts').and_return false
11
10
  File.stub!(:file?).with('spec/parallel_spec.opts').and_return false
11
+ ParallelSpecs.stub!(:bundler_enabled?).and_return false
12
12
  end
13
13
 
14
14
  it "uses TEST_ENV_NUMBER=blank when called for process 0" do
@@ -33,7 +33,7 @@ describe ParallelSpecs do
33
33
  ParallelSpecs.run_tests(['xxx'],1,'')
34
34
  end
35
35
 
36
- it "run bundle exec spec when on bundler 0.9 and rspec 1" do
36
+ it "run bundle exec spec when on bundler rspec 1" do
37
37
  File.stub!(:file?).with('script/spec').and_return false
38
38
  ParallelSpecs.stub!(:bundler_enabled?).and_return true
39
39
  ParallelSpecs.stub!(:run).with("bundle show rspec").and_return "/foo/bar/rspec-1.0.2"
@@ -41,7 +41,7 @@ describe ParallelSpecs do
41
41
  ParallelSpecs.run_tests(['xxx'],1,'')
42
42
  end
43
43
 
44
- it "run bundle exec rspec when on bundler 0.9 and rspec 2" do
44
+ it "run bundle exec rspec when on bundler rspec 2" do
45
45
  File.stub!(:file?).with('script/spec').and_return false
46
46
  ParallelSpecs.stub!(:bundler_enabled?).and_return true
47
47
  ParallelSpecs.stub!(:run).with("bundle show rspec").and_return "/foo/bar/rspec-2.0.2"
@@ -57,7 +57,7 @@ describe ParallelSpecs do
57
57
 
58
58
  it "runs spec when script/spec cannot be found" do
59
59
  File.stub!(:file?).with('script/spec').and_return false
60
- ParallelSpecs.should_receive(:open).with{|x,y| x !~ %r{(script/spec)|(bundle exec spec)}}.and_return mocked_process
60
+ ParallelSpecs.should_receive(:open).with{|x,y| x !~ %r{script/spec}}.and_return mocked_process
61
61
  ParallelSpecs.run_tests(['xxx'],1,'')
62
62
  end
63
63
 
@@ -67,19 +67,43 @@ describe ParallelSpecs do
67
67
  ParallelSpecs.run_tests(['xxx'],1,'')
68
68
  end
69
69
 
70
- it "uses spec/spec.opts when found" do
70
+ it "uses -O spec/spec.opts when found (with script/spec)" do
71
+ File.stub!(:file?).with('script/spec').and_return true
72
+ File.stub!(:file?).with('spec/spec.opts').and_return true
71
73
  ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{script/spec\s+-O spec/spec.opts}}.and_return mocked_process
72
74
  ParallelSpecs.run_tests(['xxx'],1,'')
73
75
  end
74
76
 
75
- it "uses spec/parallel_spec.opts when found" do
77
+ it "uses -O spec/parallel_spec.opts when found (with script/spec)" do
78
+ File.stub!(:file?).with('script/spec').and_return true
76
79
  File.should_receive(:file?).with('spec/parallel_spec.opts').and_return true
77
80
  ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{script/spec\s+-O spec/parallel_spec.opts}}.and_return mocked_process
78
81
  ParallelSpecs.run_tests(['xxx'],1,'')
79
82
  end
80
83
 
84
+ it "uses -O spec/parallel_spec.opts with rspec1" do
85
+ File.should_receive(:file?).with('spec/parallel_spec.opts').and_return true
86
+
87
+ ParallelSpecs.stub!(:bundler_enabled?).and_return true
88
+ ParallelSpecs.stub!(:run).with("bundle show rspec").and_return "/foo/bar/rspec-1.0.2"
89
+
90
+ ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{spec\s+ -O spec/parallel_spec.opts}}.and_return mocked_process
91
+ ParallelSpecs.run_tests(['xxx'],1,'')
92
+ end
93
+
94
+ it "uses inline options with rspec2" do
95
+ File.should_receive(:file?).with('spec/parallel_spec.opts').and_return true
96
+ File.should_receive(:read).with('spec/parallel_spec.opts').and_return "--foo\n--bar\n"
97
+
98
+ ParallelSpecs.stub!(:bundler_enabled?).and_return true
99
+ ParallelSpecs.stub!(:run).with("bundle show rspec").and_return "/foo/bar/rspec-2.0.2"
100
+
101
+ ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{rspec\s+ --foo --bar}}.and_return mocked_process
102
+ ParallelSpecs.run_tests(['xxx'],1,'')
103
+ end
104
+
81
105
  it "uses options passed in" do
82
- ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{script/spec -f n}}.and_return mocked_process
106
+ ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{rspec -f n}}.and_return mocked_process
83
107
  ParallelSpecs.run_tests(['xxx'],1,'-f n')
84
108
  end
85
109
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
1
+ require 'spec/spec_helper'
2
2
 
3
3
  describe ParallelTests do
4
4
  test_tests_in_groups(ParallelTests, 'test', '_test.rb')
@@ -138,6 +138,10 @@ EOF
138
138
  end
139
139
 
140
140
  describe :bundler_enabled? do
141
+ before do
142
+ Object.stub!(:const_defined?).with(:Bundler).and_return false
143
+ end
144
+
141
145
  it "should return false" do
142
146
  use_temporary_directory_for do
143
147
  ParallelTests.send(:bundler_enabled?).should == false
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel_tests
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 31
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 4
8
- - 7
9
- version: 0.4.7
9
+ - 8
10
+ version: 0.4.8
10
11
  platform: ruby
11
12
  authors:
12
13
  - Michael Grosser
@@ -14,19 +15,21 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-09-24 00:00:00 +02:00
18
+ date: 2010-11-23 00:00:00 +01:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- name: parallel
22
- prerelease: false
23
22
  requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
+ hash: 3
27
28
  segments:
28
29
  - 0
29
30
  version: "0"
31
+ name: parallel
32
+ prerelease: false
30
33
  type: :runtime
31
34
  version_requirements: *id001
32
35
  description:
@@ -41,6 +44,8 @@ extra_rdoc_files: []
41
44
 
42
45
  files:
43
46
  - .gitignore
47
+ - Gemfile
48
+ - Gemfile.lock
44
49
  - Rakefile
45
50
  - Readme.md
46
51
  - VERSION
@@ -71,23 +76,27 @@ rdoc_options:
71
76
  require_paths:
72
77
  - lib
73
78
  required_ruby_version: !ruby/object:Gem::Requirement
79
+ none: false
74
80
  requirements:
75
81
  - - ">="
76
82
  - !ruby/object:Gem::Version
83
+ hash: 3
77
84
  segments:
78
85
  - 0
79
86
  version: "0"
80
87
  required_rubygems_version: !ruby/object:Gem::Requirement
88
+ none: false
81
89
  requirements:
82
90
  - - ">="
83
91
  - !ruby/object:Gem::Version
92
+ hash: 3
84
93
  segments:
85
94
  - 0
86
95
  version: "0"
87
96
  requirements: []
88
97
 
89
98
  rubyforge_project:
90
- rubygems_version: 1.3.6
99
+ rubygems_version: 1.3.7
91
100
  signing_key:
92
101
  specification_version: 3
93
102
  summary: Run tests / specs / features in parallel