parallel_tests 0.13.0 → 0.13.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- parallel_tests (0.13.0)
4
+ parallel_tests (0.13.1)
5
5
  parallel
6
6
 
7
7
  GEM
@@ -15,7 +15,7 @@ GEM
15
15
  gherkin (~> 2.7.1)
16
16
  json (>= 1.4.6)
17
17
  term-ansicolor (>= 1.0.6)
18
- diff-lcs (1.1.3)
18
+ diff-lcs (1.2.4)
19
19
  gherkin (2.7.6)
20
20
  json (>= 1.4.6)
21
21
  gherkin (2.7.6-java)
@@ -24,14 +24,14 @@ GEM
24
24
  json (1.7.5-java)
25
25
  parallel (0.6.4)
26
26
  rake (10.0.3)
27
- rspec (2.12.0)
28
- rspec-core (~> 2.12.0)
29
- rspec-expectations (~> 2.12.0)
30
- rspec-mocks (~> 2.12.0)
31
- rspec-core (2.12.2)
32
- rspec-expectations (2.12.1)
33
- diff-lcs (~> 1.1.3)
34
- rspec-mocks (2.12.1)
27
+ rspec (2.13.0)
28
+ rspec-core (~> 2.13.0)
29
+ rspec-expectations (~> 2.13.0)
30
+ rspec-mocks (~> 2.13.0)
31
+ rspec-core (2.13.1)
32
+ rspec-expectations (2.13.0)
33
+ diff-lcs (>= 1.1.3, < 2.0)
34
+ rspec-mocks (2.13.1)
35
35
  term-ansicolor (1.0.7)
36
36
  test-unit (2.4.4)
37
37
 
@@ -5,15 +5,34 @@ class ParallelTests::RSpec::RuntimeLogger < ParallelTests::RSpec::LoggerBase
5
5
  def initialize(*args)
6
6
  super
7
7
  @example_times = Hash.new(0)
8
+ @group_nesting = 0 if !RSPEC_1
8
9
  end
9
10
 
10
- def example_started(*args)
11
- @time = ParallelTests.now
12
- end
11
+ if RSPEC_1
12
+ def example_started(*args)
13
+ @time = ParallelTests.now
14
+ super
15
+ end
13
16
 
14
- def example_passed(example)
15
- file = example.location.split(':').first
16
- @example_times[file] += ParallelTests.now - @time
17
+ def example_passed(example)
18
+ file = example.location.split(':').first
19
+ @example_times[file] += ParallelTests.now - @time
20
+ super
21
+ end
22
+ else
23
+ def example_group_started(example_group)
24
+ @time = ParallelTests.now if @group_nesting == 0
25
+ @group_nesting += 1
26
+ super
27
+ end
28
+
29
+ def example_group_finished(example_group)
30
+ @group_nesting -= 1
31
+ if @group_nesting == 0
32
+ @example_times[example_group.file_path] += ParallelTests.now - @time
33
+ end
34
+ super
35
+ end
17
36
  end
18
37
 
19
38
  def dump_summary(*args);end
@@ -1,3 +1,3 @@
1
1
  module ParallelTests
2
- VERSION = Version = '0.13.0'
2
+ VERSION = Version = '0.13.1'
3
3
  end
@@ -21,17 +21,9 @@ describe ParallelTests::RSpec::RuntimeLogger do
21
21
  ParallelTests::RSpec::RuntimeLogger.new(f)
22
22
  end
23
23
 
24
- example = (mock(:location => "#{Dir.pwd}/spec/foo.rb:123"))
25
- logger.example_started example
26
- logger.example_passed example
27
- if options[:pending]
28
- logger.example_pending example
29
- logger.dump_pending
30
- end
31
- if options[:failed]
32
- logger.example_failed example
33
- logger.dump_failures
34
- end
24
+ example = (mock(:file_path => "#{Dir.pwd}/spec/foo.rb"))
25
+ logger.example_group_started example
26
+ logger.example_group_finished example
35
27
  logger.start_dump
36
28
 
37
29
  #f.close
@@ -43,14 +35,6 @@ describe ParallelTests::RSpec::RuntimeLogger do
43
35
  log_for_a_file.should =~ @clean_output
44
36
  end
45
37
 
46
- it "does not log pending" do
47
- log_for_a_file(:pending => true).should =~ @clean_output
48
- end
49
-
50
- it "does not log failures" do
51
- log_for_a_file(:failed => true).should =~ @clean_output
52
- end
53
-
54
38
  it "does not log if we do not run in parallel" do
55
39
  ENV.delete 'TEST_ENV_NUMBER'
56
40
  log_for_a_file.should == ""
@@ -87,8 +71,6 @@ describe ParallelTests::RSpec::RuntimeLogger do
87
71
  end
88
72
 
89
73
  it "logs shared examples into the running files" do
90
- pending "no support in rspec for this :/"
91
-
92
74
  write "spec/spec_helper.rb", <<-RUBY
93
75
  shared_examples "foo" do
94
76
  it "is slow" do
@@ -109,9 +91,36 @@ describe ParallelTests::RSpec::RuntimeLogger do
109
91
  system("TEST_ENV_NUMBER=1 rspec spec -I #{Bundler.root.join("lib")} --format ParallelTests::RSpec::RuntimeLogger --out runtime.log 2>&1") || raise("nope")
110
92
 
111
93
  result = File.read("runtime.log")
112
- result.should include "a_spec:0.5"
113
- result.should include "b_spec:0.5"
94
+ result.should include "a_spec.rb:0.5"
95
+ result.should include "b_spec.rb:0.5"
114
96
  result.should_not include "spec_helper"
115
97
  end
98
+
99
+ it "logs multiple describe blocks" do
100
+ write "spec/a_spec.rb", <<-RUBY
101
+ describe "xxx" do
102
+ it "is slow" do
103
+ sleep 0.5
104
+ end
105
+ end
106
+
107
+ describe "yyy" do
108
+ it "is slow" do
109
+ sleep 0.5
110
+ end
111
+
112
+ describe "yep" do
113
+ it "is slow" do
114
+ sleep 0.5
115
+ end
116
+ end
117
+ end
118
+ RUBY
119
+
120
+ system("TEST_ENV_NUMBER=1 rspec spec -I #{Bundler.root.join("lib")} --format ParallelTests::RSpec::RuntimeLogger --out runtime.log 2>&1") || raise("nope")
121
+
122
+ result = File.read("runtime.log")
123
+ result.should include "a_spec.rb:1.5"
124
+ end
116
125
  end
117
126
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.13.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -96,7 +96,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  segments:
98
98
  - 0
99
- hash: 1322916282781841977
99
+ hash: 869070716249185077
100
100
  required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  none: false
102
102
  requirements:
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  segments:
107
107
  - 0
108
- hash: 1322916282781841977
108
+ hash: 869070716249185077
109
109
  requirements: []
110
110
  rubyforge_project:
111
111
  rubygems_version: 1.8.25