Fix granularity of test selection under rspec
This commit is contained in:
parent
27bb96bd94
commit
11820be9db
2 changed files with 22 additions and 18 deletions
|
@ -23,6 +23,16 @@ module Mutant
|
||||||
end
|
end
|
||||||
memoize :setup
|
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
|
# Return report for test
|
||||||
#
|
#
|
||||||
# @param [Rspec::Test] test
|
# @param [Rspec::Test] test
|
||||||
|
@ -51,7 +61,10 @@ module Mutant
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
def all_tests
|
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)
|
Test.new(self, example_group)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -94,20 +107,6 @@ module Mutant
|
||||||
end
|
end
|
||||||
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 configuration
|
||||||
#
|
#
|
||||||
# @return [RSpec::Core::Configuration]
|
# @return [RSpec::Core::Configuration]
|
||||||
|
|
|
@ -13,7 +13,12 @@ module Mutant
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
def subject_identification
|
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
|
end
|
||||||
memoize :subject_identification
|
memoize :subject_identification
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue