Automatically expand scope of example groups

Given a subject Foo::Bar#baz mutant will run example groups with
description starting with:

  - Foo::Bar#baz
  - Foo::Bar
  - Foo

This basically means you can kill a mutation via a dedicated spec for a
given method, all specs for a given object or all the specs within the
object's namespace.

In most of the cases you should target killing mutations via a dedicated
spec for a particular method *however* there are valid cases where
implicit coverage is absolutely fine.
This commit is contained in:
Piotr Solnica 2013-08-05 18:21:10 +00:00
parent 4c024ad3a9
commit e1edf672dc

View file

@ -29,7 +29,7 @@ module Mutant
reporter = RSpec::Core::Reporter.new
example_groups.each do |group|
groups.each do |group|
return true unless group.run(reporter)
end
@ -53,12 +53,7 @@ module Mutant
# @api private
#
def example_groups
match_prefixes.each do |match_expression|
example_groups = find_with(match_expression)
return example_groups unless example_groups.empty?
end
nil
match_prefixes.flat_map { |prefix| find_with(prefix) }.compact.uniq
end
# Return example groups that match expression