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
|
||||
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,9 +61,12 @@ module Mutant
|
|||
# @api private
|
||||
#
|
||||
def all_tests
|
||||
example_groups.map do |example_group|
|
||||
Test.new(self, example_group)
|
||||
end
|
||||
example_groups
|
||||
.flat_map(&:descendants)
|
||||
.select { |example_group| example_group.descendants.one? }
|
||||
.map do |example_group|
|
||||
Test.new(self, example_group)
|
||||
end
|
||||
end
|
||||
memoize :all_tests
|
||||
|
||||
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue