flakey_spec_catcher 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16de08551fe8e8417b75b81548de5a56cc64b0a90e3b4458c0e515938b52a954
4
- data.tar.gz: 5e98f8c50760a963463b713e04eaf74240b382a99b9e577187bdef61789e28ca
3
+ metadata.gz: cfd29938b0542b31562ef717b6a5bc89f96dc78afa35daac74e408f93486309f
4
+ data.tar.gz: 930d3b0b85d2bb214363c70dd3ea2f8959e16cba83650d3d804721113e824a5d
5
5
  SHA512:
6
- metadata.gz: fb1e1e3dbbeba8c3441f1b7f56d9b79e3438d36261a679afef5855f59cdd27d34d6eb195f2705b76f399513ca9ecb5d0d2d17cbb893851d1bf7f4a10b82b2ce1
7
- data.tar.gz: 050eed36f9fcb9c50b3a1bc0ce22ead64572d5b9ebcc2efe0474882e5f61315528104c79151fc8571303e09106c440ebf02f7f42d5f7e87c697bf97c42e6736a
6
+ metadata.gz: 4d8133daadc9181017af45abfdda0200825cef3605459a1d4ca5a21a524b5b7d7ef9dfd8643b4545c2d2761aba103a71bbf4fbba1ee3adb1b10d60e5b6a51353
7
+ data.tar.gz: 0d1d43b5ed4f93b1e21b871c03cf38e524c05c99a8f29a46998f78e867bc10d431143df64083a0b041c927e657120aac6007248b2a10955bcd581b0c583a0f4c
@@ -16,12 +16,14 @@ module FlakeySpecCatcher
16
16
 
17
17
  def example_failed(notification)
18
18
  description = notification.example.full_description.to_s.strip
19
- @result_manager.add_result(description, format_message(notification))
19
+ location = notification.example.location
20
+ @result_manager.add_result(description, location, format_message(notification))
20
21
  end
21
22
 
22
23
  def example_passed(notification)
23
24
  description = notification.example.full_description.to_s.strip
24
- @result_manager.add_result(description)
25
+ location = notification.example.location
26
+ @result_manager.add_result(description, location)
25
27
  end
26
28
 
27
29
  private
@@ -12,10 +12,11 @@ module FlakeySpecCatcher
12
12
  # re-run of that spec, the results will be pushed to the RspecResult object.
13
13
  # This class will then organize and output the results accordingly.
14
14
  class RspecResult
15
- attr_accessor :description, :total_times_run, :total_failures
15
+ attr_accessor :description, :location, :total_times_run, :total_failures
16
16
 
17
- def initialize(description, exception_message = nil)
17
+ def initialize(description, location, exception_message = nil)
18
18
  @description = description
19
+ @location = location
19
20
  @total_times_run = 1
20
21
  @total_failures = exception_message ? 1 : 0
21
22
  @failures = []
@@ -37,7 +38,9 @@ module FlakeySpecCatcher
37
38
  end
38
39
 
39
40
  def print_results
40
- puts "\n#{@description.yellow}\nFAILED #{total_failures} / #{total_times_run} times"
41
+ puts "\n#{@description.yellow} (#{location})
42
+ \nFAILED #{total_failures} / #{total_times_run} times"
43
+
41
44
  @failures.each do |f|
42
45
  puts "#{f.count.to_s.indent(2)} times with exception message:"
43
46
  puts f.exception_message.indent(4).red.to_s
@@ -17,9 +17,9 @@ module FlakeySpecCatcher
17
17
  @results = []
18
18
  end
19
19
 
20
- def add_result(description, message = nil)
21
- result = @results.find { |r| r.description == description }
22
- result ? result.add_run(message) : @results.push(@result_class.new(description, message))
20
+ def add_result(desc, location, message = nil)
21
+ result = @results.find { |r| r.location == location }
22
+ result ? result.add_run(message) : @results.push(@result_class.new(desc, location, message))
23
23
  end
24
24
 
25
25
  def print_results
@@ -43,7 +43,11 @@ module FlakeySpecCatcher
43
43
  private
44
44
 
45
45
  def print_successes_count(successes)
46
- puts "#{successes.count} example(s) ran without any failures".green if successes.any?
46
+ return unless successes.any?
47
+
48
+ rerun_count = successes.first.total_times_run
49
+ msg = "#{successes.count} example(s) ran #{rerun_count} times without any failures"
50
+ puts msg.green
47
51
  end
48
52
  end
49
53
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FlakeySpecCatcher
4
- VERSION = '0.6.0'
4
+ VERSION = '0.6.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flakey_spec_catcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Watson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-12-17 00:00:00.000000000 Z
13
+ date: 2020-01-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -122,8 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  requirements: []
125
- rubyforge_project:
126
- rubygems_version: 2.7.7
125
+ rubygems_version: 3.0.3
127
126
  signing_key:
128
127
  specification_version: 4
129
128
  summary: Run new or changed specs many times to prevent unreliable specs