Prevent ignore of metadata duplicates in rspec integration
* Example groups with identical metadata still can represent different test cases. * Using the relative example group index as an additional key resolves this. [fixes #279]
This commit is contained in:
parent
af4b543a18
commit
ae65509258
1 changed files with 6 additions and 5 deletions
|
@ -81,28 +81,29 @@ module Mutant
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
def all_tests_index
|
def all_tests_index
|
||||||
all_examples.each_with_object({}) do |example, index|
|
all_examples.each_with_index.each_with_object({}) do |(example, example_index), index|
|
||||||
index[parse_example(example)] = example
|
index[parse_example(example, example_index)] = example
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
memoize :all_tests_index
|
memoize :all_tests_index
|
||||||
|
|
||||||
# Parse example into test
|
# Parse example into test
|
||||||
#
|
#
|
||||||
# @param [RSpec::Core::Example]
|
# @param [RSpec::Core::Example] example
|
||||||
|
# @param [Fixnum] index
|
||||||
#
|
#
|
||||||
# @return [Test]
|
# @return [Test]
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
def parse_example(example)
|
def parse_example(example, index)
|
||||||
metadata = example.metadata
|
metadata = example.metadata
|
||||||
location = metadata.fetch(:location)
|
location = metadata.fetch(:location)
|
||||||
full_description = metadata.fetch(:full_description)
|
full_description = metadata.fetch(:full_description)
|
||||||
expression = Expression.try_parse(full_description.split(EXPRESSION_DELIMITER, 2).first) || ALL
|
expression = Expression.try_parse(full_description.split(EXPRESSION_DELIMITER, 2).first) || ALL
|
||||||
|
|
||||||
Test.new(
|
Test.new(
|
||||||
id: "rspec:#{example.object_id}/#{location}/#{full_description}",
|
id: "rspec:#{index}:#{location}/#{full_description}",
|
||||||
expression: expression
|
expression: expression
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue