flakey_spec_catcher 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flakey_spec_catcher/change_capsule.rb +15 -6
- data/lib/flakey_spec_catcher/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a88793e18d2fc8a483639620b2876b4955f3fc8a5425f41a25cc2e3509cd6e0
|
4
|
+
data.tar.gz: f4c0a38a03eb0fabcde7111f3bf8bfc3698a7c5c576a106fb7c7b4337ed782b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c033294dc195ab6784dc22919ff986f7e646657b85a7efe6a5780333b666b4a7c7bba5f10ab41839ee9574cd9f4307a6f9b6c276f5da4f9144b5828dd1f2e06
|
7
|
+
data.tar.gz: 00a950c3296e05a81c8294c2005d6c84b454296de2f697b7ef2152ec6f29ef02c6305b3749d3a2d1449436fa1b6fb6ac0ccc2d9e3f5ae9db7ebef04043db2b96
|
@@ -24,23 +24,30 @@ module FlakeySpecCatcher
|
|
24
24
|
@change_contexts.map(&:rerun_info)
|
25
25
|
end
|
26
26
|
|
27
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
27
28
|
def fill_contexts
|
28
29
|
change_context_stack = []
|
29
30
|
ignore_scope_closure = 0
|
30
31
|
lines_in_file = File.read(@file_name).split("\n")
|
31
32
|
lines_in_file.each_with_index do |line, index|
|
33
|
+
shared_example_identified = false
|
34
|
+
|
32
35
|
# Check if line matches an rspec example or examplegroup format
|
33
36
|
if line =~ spec_scope
|
34
37
|
handle_change_context(line, index, change_context_stack)
|
35
38
|
# Else, ignore other blocks that might pollute context stack
|
39
|
+
elsif line =~ shared_example_scope
|
40
|
+
handle_change_context(line, index, change_context_stack)
|
41
|
+
shared_example_identified = true
|
36
42
|
elsif line_matches_method_or_block(line)
|
37
43
|
ignore_scope_closure += 1
|
38
44
|
end
|
39
45
|
|
40
46
|
fill_context(line, index, change_context_stack)
|
41
47
|
|
42
|
-
|
43
|
-
|
48
|
+
if shared_example_identified
|
49
|
+
change_context_stack.pop
|
50
|
+
elsif line =~ pop_scope
|
44
51
|
if ignore_scope_closure.positive?
|
45
52
|
ignore_scope_closure -= 1
|
46
53
|
else
|
@@ -49,6 +56,7 @@ module FlakeySpecCatcher
|
|
49
56
|
end
|
50
57
|
end
|
51
58
|
end
|
59
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
52
60
|
|
53
61
|
private
|
54
62
|
|
@@ -70,14 +78,15 @@ module FlakeySpecCatcher
|
|
70
78
|
end
|
71
79
|
|
72
80
|
def spec_scope
|
73
|
-
# Not sure if we need to check for description in quotes
|
74
|
-
# spec_scope = /^\s*(#{SCOPE_SPECIFIERS.join("|")})\s*('.*'|".*").*do\s*$/
|
75
|
-
|
76
81
|
/\s*(#{SCOPE_SPECIFIERS.join("|")}).*\s+do.*$/
|
77
82
|
end
|
78
83
|
|
84
|
+
def shared_example_scope
|
85
|
+
/\s*(#{SHARED_EXAMPLES.join("|")}).*\s+.*$/
|
86
|
+
end
|
87
|
+
|
79
88
|
def line_matches_method_or_block(line)
|
80
|
-
return true if line =~ /\s*do(\s+|$)/ || line =~ /^\s*def\s+/ || line =~ /^\s*if\s+/
|
89
|
+
return true if line =~ /\s*do(\s+|$)/ || line =~ /^\s*def\s+/ || line =~ /^\s*if\s+/ || line =~ /^\s*class\s+/
|
81
90
|
|
82
91
|
false
|
83
92
|
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.11.
|
4
|
+
version: 0.11.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: 2021-10-
|
13
|
+
date: 2021-10-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|