Merge pull request #513 from mbj/fix/rspec-test-id-generation

Fix rspec test id generation to be simpler
This commit is contained in:
Dan Kubb 2016-01-11 11:43:07 -08:00
commit 86de7446e1
2 changed files with 10 additions and 5 deletions

View file

@ -1,3 +1,3 @@
---
threshold: 18
total_score: 1173
total_score: 1169

View file

@ -24,6 +24,7 @@ module Mutant
LOCATION_DELIMITER = ':'.freeze
EXIT_SUCCESS = 0
CLI_OPTIONS = IceNine.deep_freeze(%w[spec --fail-fast])
TEST_ID_FORMAT = 'rspec:%<index>d:%<location>s/%<description>s'.freeze
private_constant(*constants(false))
@ -97,12 +98,16 @@ module Mutant
# @return [Test]
def parse_example(example, index)
metadata = example.metadata
location = metadata.fetch(:location)
full_description = metadata.fetch(:full_description)
id = TEST_ID_FORMAT % {
index: index,
location: metadata.fetch(:location),
description: metadata.fetch(:full_description)
}
Test.new(
expression: parse_expression(metadata),
id: "rspec:#{index}:#{location}/#{full_description}"
id: id
)
end