Fix prefix check for equivalent recursive namespaces

This commit is contained in:
Markus Schirp 2018-11-16 15:44:47 +00:00
parent cd4703182d
commit 2fda7cb662
2 changed files with 4 additions and 2 deletions

View file

@ -44,7 +44,9 @@ module Mutant
#
# @return [Integer]
def match_length(expression)
if @recursion_pattern.match?(expression.syntax)
if eql?(expression)
syntax.length
elsif @recursion_pattern.match?(expression.syntax)
scope_name.length
else
0

View file

@ -22,7 +22,7 @@ RSpec.describe Mutant::Expression::Namespace::Recursive do
context 'when other is an equivalent expression' do
let(:other) { parse_expression(object.syntax) }
it { should be(0) }
it { should be(object.syntax.length) }
end
context 'when other expression describes a shorter prefix' do