Skip to content

Commit 7610b13

Browse files
committed
Fix rspec metadata parsing on empty full description
[Fix #1237]
1 parent ee3d5c2 commit 7610b13

12 files changed

+45
-26
lines changed

Changelog.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
# v0.12.4 2024-06-30
2+
3+
* [#1453](https://github.com/mbj/mutant/pull/1454)
4+
5+
Fix parsing of empty rspec descriptions
6+
17
# v0.12.3 2024-06-10
28

39
* [#1452](https://github.com/mbj/mutant/pull/1451)
410

511
Remove support for EOL Ruby-3.0.
612
Remove another invalid mutation to super().
713

8-
914
# v0.12.2 2024-06-09
1015

1116
* [#1450](https://github.com/mbj/mutant/pull/1450)

Gemfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
mutant (0.12.3)
4+
mutant (0.12.4)
55
diff-lcs (~> 1.3)
66
parser (~> 3.3.0)
77
regexp_parser (~> 2.9.0)

lib/mutant/integration/rspec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def parse_metadata(metadata)
167167

168168
expressions.map(&method(:parse_expression))
169169
else
170-
match = EXPRESSION_CANDIDATE.match(metadata.fetch(:full_description))
170+
match = EXPRESSION_CANDIDATE.match(metadata.fetch(:full_description)) or return [ALL_EXPRESSION]
171171
[parse_expression(Util.one(match.captures)) { ALL_EXPRESSION }]
172172
end
173173
end

lib/mutant/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
module Mutant
44
# Current mutant version
5-
VERSION = '0.12.3'
5+
VERSION = '0.12.4'
66
end # Mutant

spec/unit/mutant/integration/rspec_spec.rb

+15-1
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,21 @@
8383
)
8484
end
8585

86+
let(:example_g) do
87+
double(
88+
'Example G',
89+
metadata: {
90+
location: 'example-g-location',
91+
full_description: ''
92+
}
93+
)
94+
end
95+
8696
let(:leaf_example_group) do
8797
class_double(
8898
RSpec::Core::ExampleGroup,
8999
'leaf example group',
90-
examples: [example_a, example_b, example_c, example_d, example_e, example_f]
100+
examples: [example_a, example_b, example_c, example_d, example_e, example_f, example_g]
91101
)
92102
end
93103

@@ -147,6 +157,10 @@
147157
Mutant::Test.new(
148158
id: 'rspec:5:example-f-location/Example::F',
149159
expressions: [parse_expression('Foo'), parse_expression('Bar')]
160+
),
161+
Mutant::Test.new(
162+
id: 'rspec:6:example-g-location/',
163+
expressions: [parse_expression('*')]
150164
)
151165
]
152166
end

test_app/Gemfile.minitest.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
PATH
22
remote: ..
33
specs:
4-
mutant (0.12.3)
4+
mutant (0.12.4)
55
diff-lcs (~> 1.3)
66
parser (~> 3.3.0)
77
regexp_parser (~> 2.9.0)
88
sorbet-runtime (~> 0.5.0)
99
unparser (~> 0.6.14)
10-
mutant-minitest (0.12.3)
10+
mutant-minitest (0.12.4)
1111
minitest (~> 5.11)
12-
mutant (= 0.12.3)
12+
mutant (= 0.12.4)
1313

1414
GEM
1515
remote: https://rubygems.org/

test_app/Gemfile.rspec3.10.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
PATH
22
remote: ..
33
specs:
4-
mutant (0.12.3)
4+
mutant (0.12.4)
55
diff-lcs (~> 1.3)
66
parser (~> 3.3.0)
77
regexp_parser (~> 2.9.0)
88
sorbet-runtime (~> 0.5.0)
99
unparser (~> 0.6.14)
10-
mutant-rspec (0.12.3)
11-
mutant (= 0.12.3)
10+
mutant-rspec (0.12.4)
11+
mutant (= 0.12.4)
1212
rspec-core (>= 3.8.0, < 4.0.0)
1313

1414
GEM

test_app/Gemfile.rspec3.11.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
PATH
22
remote: ..
33
specs:
4-
mutant (0.12.3)
4+
mutant (0.12.4)
55
diff-lcs (~> 1.3)
66
parser (~> 3.3.0)
77
regexp_parser (~> 2.9.0)
88
sorbet-runtime (~> 0.5.0)
99
unparser (~> 0.6.14)
10-
mutant-rspec (0.12.3)
11-
mutant (= 0.12.3)
10+
mutant-rspec (0.12.4)
11+
mutant (= 0.12.4)
1212
rspec-core (>= 3.8.0, < 4.0.0)
1313

1414
GEM

test_app/Gemfile.rspec3.12.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
PATH
22
remote: ..
33
specs:
4-
mutant (0.12.3)
4+
mutant (0.12.4)
55
diff-lcs (~> 1.3)
66
parser (~> 3.3.0)
77
regexp_parser (~> 2.9.0)
88
sorbet-runtime (~> 0.5.0)
99
unparser (~> 0.6.14)
10-
mutant-rspec (0.12.3)
11-
mutant (= 0.12.3)
10+
mutant-rspec (0.12.4)
11+
mutant (= 0.12.4)
1212
rspec-core (>= 3.8.0, < 4.0.0)
1313

1414
GEM

test_app/Gemfile.rspec3.13.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
PATH
22
remote: ..
33
specs:
4-
mutant (0.12.3)
4+
mutant (0.12.4)
55
diff-lcs (~> 1.3)
66
parser (~> 3.3.0)
77
regexp_parser (~> 2.9.0)
88
sorbet-runtime (~> 0.5.0)
99
unparser (~> 0.6.14)
10-
mutant-rspec (0.12.3)
11-
mutant (= 0.12.3)
10+
mutant-rspec (0.12.4)
11+
mutant (= 0.12.4)
1212
rspec-core (>= 3.8.0, < 4.0.0)
1313

1414
GEM

test_app/Gemfile.rspec3.8.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
PATH
22
remote: ..
33
specs:
4-
mutant (0.12.3)
4+
mutant (0.12.4)
55
diff-lcs (~> 1.3)
66
parser (~> 3.3.0)
77
regexp_parser (~> 2.9.0)
88
sorbet-runtime (~> 0.5.0)
99
unparser (~> 0.6.14)
10-
mutant-rspec (0.12.3)
11-
mutant (= 0.12.3)
10+
mutant-rspec (0.12.4)
11+
mutant (= 0.12.4)
1212
rspec-core (>= 3.8.0, < 4.0.0)
1313

1414
GEM

test_app/Gemfile.rspec3.9.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
PATH
22
remote: ..
33
specs:
4-
mutant (0.12.3)
4+
mutant (0.12.4)
55
diff-lcs (~> 1.3)
66
parser (~> 3.3.0)
77
regexp_parser (~> 2.9.0)
88
sorbet-runtime (~> 0.5.0)
99
unparser (~> 0.6.14)
10-
mutant-rspec (0.12.3)
11-
mutant (= 0.12.3)
10+
mutant-rspec (0.12.4)
11+
mutant (= 0.12.4)
1212
rspec-core (>= 3.8.0, < 4.0.0)
1313

1414
GEM

0 commit comments

Comments
 (0)