From e92358b3cc81f4bdc9f30cd7494ad94e2fed501a Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Sat, 9 Jan 2016 16:05:34 +0000 Subject: [PATCH] Fix rspec test id generation to be simpler --- config/flay.yml | 2 +- lib/mutant/integration/rspec.rb | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/config/flay.yml b/config/flay.yml index fdafaff5..ded1bf5e 100644 --- a/config/flay.yml +++ b/config/flay.yml @@ -1,3 +1,3 @@ --- threshold: 18 -total_score: 1173 +total_score: 1169 diff --git a/lib/mutant/integration/rspec.rb b/lib/mutant/integration/rspec.rb index 98a76070..9d2c6342 100644 --- a/lib/mutant/integration/rspec.rb +++ b/lib/mutant/integration/rspec.rb @@ -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:%d:%s/%s'.freeze private_constant(*constants(false)) @@ -96,13 +97,17 @@ module Mutant # # @return [Test] def parse_example(example, index) - metadata = example.metadata - location = metadata.fetch(:location) - full_description = metadata.fetch(:full_description) + metadata = example.metadata + + 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