parallelized_specs 0.3.18 → 0.3.19

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ begin
12
12
  gem.email = "jake@instructure.com"
13
13
  gem.homepage = "http://github.com/jakesorce/#{gem.name}"
14
14
  gem.authors = "Jake Sorce, Bryan Madsen, Shawn Meredith"
15
- gem.version = "0.3.18"
15
+ gem.version = "0.3.19"
16
16
  end
17
17
  Jeweler::GemcutterTasks.new
18
18
  rescue LoadError
@@ -3,6 +3,8 @@ require 'parallelized_specs/spec_logger_base'
3
3
 
4
4
  module RSpec
5
5
  class ParallelizedSpecs::FailuresFormatter < ParallelizedSpecs::SpecLoggerBase
6
+ #env_test_number = ENV['TEST_ENV_NUMBER']
7
+ #env_test_number = 1 if ENV['TEST_ENV_NUMBER'].nil
6
8
  FILENAME = "#{RAILS_ROOT}/rspec.failures"
7
9
 
8
10
  def example_failed(example, counter, failure)
@@ -12,18 +14,61 @@ module RSpec
12
14
  f.puts retry_command(example)
13
15
  end
14
16
 
15
- def dump_summary(*args);end
17
+ def dump_summary(*args)
18
+ ;
19
+ end
16
20
 
17
- def dump_failures(*args);end
21
+ def dump_failures(*args)
22
+ ;
23
+ end
18
24
 
19
- def dump_failure(*args);end
25
+ def dump_failure(*args)
26
+ ;
27
+ end
20
28
 
21
- def dump_pending(*args);end
29
+ def dump_pending(*args)
30
+ ;
31
+ end
22
32
 
23
33
  def retry_command(example)
24
34
  spec_file = example_group.location.gsub("\"", "\\\"").match(/spec.*b/).to_s
25
35
  spec_name = example.description
26
- "SPEC=#{spec_file} SPEC_OPTS='-e \"#{spec_name}\"'"
36
+ "SPEC=#{Dir.pwd}/#{spec_file} SPEC_OPTS='-e \"#{spec_name}\"'"
27
37
  end
38
+
39
+ def close()
40
+ rerun_failed_examples = false
41
+ @rerun_failures ||= []
42
+ @rerun_passes ||= []
43
+ @error_count = %x{wc -l "#{RAILS_ROOT}/#{FILENAME}"}.match(/\d/).to_s #counts the number of lines in the file
44
+
45
+ File.open("#{RAILS_ROOT}/#{FILENAME}").each_line do |l|
46
+ if @error_count.to_i > 1 && 10 # if there is 1 line but less that 10 errors the rerun will run
47
+ rerun_failed_examples = true
48
+ result = %x[bundle exec rake spec #{l}]
49
+ rerun_status = result.match(/FAILED/).to_s
50
+
51
+ if rerun_status == "FAILED"
52
+ @rerun_failures << l
53
+ rerun_status = ""
54
+ else
55
+ @rerun_passes << l
56
+ rerun_status = ""
57
+ end
58
+ end
59
+ end #end file loop
60
+
61
+ if rerun_failed_examples
62
+ if @rerun_failures.length > 0
63
+ puts "1 or more examples failed on rerun, rspec will mark this build as a failure"
64
+ else
65
+ puts "all rerun examples passed, rspec will mark this build as passed"
66
+ $rerun_success = true
67
+ Spec::Runner.options.instance_variable_get(:@reporter).instance_variable_get(:@failures).delete_if { |item| item != 'b' } #placeholder delete all failures in array approach
68
+ end
69
+ else
70
+ end
71
+ @output.close if (IO === @output) & (@output != $stdout)
28
72
  end
29
73
  end
74
+ end
@@ -10,6 +10,7 @@ require 'parallelized_specs/example_failures_logger'
10
10
  require 'parallelized_specs/trending_example_failures_logger'
11
11
  require 'parallelized_specs/failures_rerun_logger'
12
12
 
13
+
13
14
  class ParallelizedSpecs
14
15
  VERSION = File.read(File.join(File.dirname(__FILE__), '..', 'VERSION')).strip
15
16
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "parallelized_specs"
8
- s.version = "0.3.18"
8
+ s.version = "0.3.19"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jake Sorce, Bryan Madsen, Shawn Meredith"]
12
- s.date = "2012-10-25"
12
+ s.date = "2012-10-29"
13
13
  s.email = "jake@instructure.com"
14
14
  s.files = [
15
15
  "Gemfile",
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: 55
4
+ hash: 53
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 18
10
- version: 0.3.18
9
+ - 19
10
+ version: 0.3.19
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jake Sorce, Bryan Madsen, Shawn Meredith
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-10-25 00:00:00 Z
18
+ date: 2012-10-29 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: parallel