parallelized_specs 0.2.2 → 0.2.3

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.2.2"
15
+ gem.version = "0.2.3"
16
16
  end
17
17
 
18
18
  Jeweler::GemcutterTasks.new
@@ -5,6 +5,8 @@ require 'parallelized_specs/railtie'
5
5
  require 'parallelized_specs/spec_error_logger'
6
6
  require 'parallelized_specs/spec_error_count_logger'
7
7
  require 'parallelized_specs/spec_start_finish_logger'
8
+ require 'parallelized_specs/shared_example_failures_logger'
9
+ require 'parallelized_specs/example_failures_logger'
8
10
 
9
11
  class ParallelizedSpecs
10
12
  VERSION = File.read(File.join(File.dirname(__FILE__), '..', 'VERSION')).strip
@@ -0,0 +1,33 @@
1
+ require 'parallelized_specs/spec_logger_base'
2
+
3
+ class ParallelizedSpecs::ExampleRerunFailuresLogger < ParallelizedSpecs::SpecLoggerBase
4
+
5
+ def example_failed(example, *args)
6
+ if RSPEC_1
7
+ unless !!self.example_group.nested_descriptions.to_s.match(/shared/) || !!self.instance_variable_get(:@example_group).examples.last.location.match(/helper/)
8
+ @failed_examples ||= []
9
+ @failed_examples << "#{example.location.match(/spec.*\d/).to_s} "
10
+ end
11
+ else
12
+ super
13
+ end
14
+ end
15
+
16
+ # RSpec 1: dumps 1 failed spec
17
+ def dump_failure(*args)
18
+ end
19
+
20
+ # RSpec 2: dumps all failed specs
21
+ def dump_failures(*args)
22
+ end
23
+
24
+ def dump_summary(*args)
25
+ lock_output do
26
+ if RSPEC_1
27
+ @output.puts "#{@failed_examples.to_s}"
28
+ end
29
+ end
30
+ @output.flush
31
+ end
32
+ end
33
+
@@ -0,0 +1,43 @@
1
+ require 'parallelized_specs/spec_logger_base'
2
+
3
+ class ParallelizedSpecs::SharedExampleRerunFailuresLogger < ParallelizedSpecs::SpecLoggerBase
4
+
5
+ def example_failed(example, *args)
6
+ if RSPEC_1
7
+ @failed_shared_examples ||= {}
8
+ spec_caller = self.example_group.backtrace.match(/spec.*\d/).to_s #regex later to get right relative path
9
+ failed_shared_spec = example.location.match(/spec.*\d/).to_s
10
+
11
+ if !!self.example_group.nested_descriptions.to_s.match(/shared/) || !!self.instance_variable_get(:@example_group).examples.last.location.match(/helper/)
12
+ if spec_caller == @failed_shared_examples.keys.last || spec_caller == @failed_shared_examples.keys.first || !!spec_caller.match(/helper/)
13
+ key = @failed_shared_examples.keys.first
14
+ @failed_shared_examples[key] << "#{failed_shared_spec} "
15
+ else
16
+ @failed_shared_examples["#{spec_caller}"] = ["#{failed_shared_spec} "]
17
+ end
18
+ end
19
+ else
20
+ super
21
+ end
22
+ end
23
+
24
+ # RSpec 1: dumps 1 failed spec
25
+ def dump_failure(*args)
26
+ end
27
+
28
+ # RSpec 2: dumps all failed specs
29
+ def dump_failures(*args)
30
+ end
31
+
32
+ def dump_summary(*args)
33
+ lock_output do
34
+ if RSPEC_1
35
+ (@failed_shared_examples||{}).each_pair do |caller, example|
36
+ @output.puts "#{caller}:\n\n #{example}\n\n "
37
+ end
38
+ end
39
+ @output.flush
40
+ end
41
+ end
42
+
43
+ end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "parallelized_specs"
8
- s.version = "0.2.2"
8
+ s.version = "0.2.3"
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"]
@@ -18,9 +18,11 @@ Gem::Specification.new do |s|
18
18
  "Readme.md",
19
19
  "VERSION",
20
20
  "lib/parallelized_specs.rb",
21
+ "lib/parallelized_specs/example_failures_logger.rb",
21
22
  "lib/parallelized_specs/grouper.rb",
22
23
  "lib/parallelized_specs/railtie.rb",
23
24
  "lib/parallelized_specs/runtime_logger.rb",
25
+ "lib/parallelized_specs/shared_example_failures_logger.rb",
24
26
  "lib/parallelized_specs/spec_error_count_logger.rb",
25
27
  "lib/parallelized_specs/spec_error_logger.rb",
26
28
  "lib/parallelized_specs/spec_failures_logger.rb",
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: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 2
10
- version: 0.2.2
9
+ - 3
10
+ version: 0.2.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jake Sorce, Bryan Madsen, Shawn Meredith
@@ -46,9 +46,11 @@ files:
46
46
  - Readme.md
47
47
  - VERSION
48
48
  - lib/parallelized_specs.rb
49
+ - lib/parallelized_specs/example_failures_logger.rb
49
50
  - lib/parallelized_specs/grouper.rb
50
51
  - lib/parallelized_specs/railtie.rb
51
52
  - lib/parallelized_specs/runtime_logger.rb
53
+ - lib/parallelized_specs/shared_example_failures_logger.rb
52
54
  - lib/parallelized_specs/spec_error_count_logger.rb
53
55
  - lib/parallelized_specs/spec_error_logger.rb
54
56
  - lib/parallelized_specs/spec_failures_logger.rb