Fix granularity of test selection under rspec

This commit is contained in:
Markus Schirp 2014-05-27 13:23:08 +00:00
parent 27bb96bd94
commit 11820be9db
2 changed files with 22 additions and 18 deletions

View file

@ -23,6 +23,16 @@ module Mutant
end
memoize :setup
# Test for rspec2
#
# @return [Boolean]
#
# @api private
#
def rspec2?
RSpec::Core::Version::STRING.start_with?(RSPEC_2_VERSION_PREFIX)
end
# Return report for test
#
# @param [Rspec::Test] test
@ -51,7 +61,10 @@ module Mutant
# @api private
#
def all_tests
example_groups.map do |example_group|
example_groups
.flat_map(&:descendants)
.select { |example_group| example_group.descendants.one? }
.map do |example_group|
Test.new(self, example_group)
end
end
@ -94,20 +107,6 @@ module Mutant
end
end
# Detect RSpec 2
#
# @return [true]
# when RSpec 2
#
# @return [false]
# otherwise
#
# @api private
#
def rspec2?
RSpec::Core::Version::STRING.start_with?(RSPEC_2_VERSION_PREFIX)
end
# Return configuration
#
# @return [RSpec::Core::Configuration]

View file

@ -13,7 +13,12 @@ module Mutant
# @api private
#
def subject_identification
example_group.description
metadata = example_group.metadata
if strategy.rspec2?
metadata.fetch(:example_group).fetch(:full_description)
else
metadata.fetch(:full_description)
end
end
memoize :subject_identification