diff --git a/lib/mutant/context/scope.rb b/lib/mutant/context/scope.rb index 0ad28624..b06c2b34 100644 --- a/lib/mutant/context/scope.rb +++ b/lib/mutant/context/scope.rb @@ -96,7 +96,10 @@ module Mutant # @api private # def match_prefixes - name_nesting.reverse + names = name_nesting + names.length.downto(1).map do |last| + names[0...last].join('::') + end end memoize :match_prefixes diff --git a/lib/mutant/subject.rb b/lib/mutant/subject.rb index 19c62f6e..f032a24e 100644 --- a/lib/mutant/subject.rb +++ b/lib/mutant/subject.rb @@ -99,7 +99,7 @@ module Mutant # @api private # def match_prefixes - context.match_prefixes.dup << match_expression + [match_expression].concat(context.match_prefixes) end memoize :match_prefixes