diff --git a/lib/mutant/context/scope.rb b/lib/mutant/context/scope.rb index dd208ea3..058854cc 100644 --- a/lib/mutant/context/scope.rb +++ b/lib/mutant/context/scope.rb @@ -97,7 +97,7 @@ module Mutant # def match_expressions name_nesting.each_index.reverse_each.map do |index| - Expression.parse_strict(name_nesting.take(index.succ).join(NAMESPACE_DELIMITER)) + Expression.parse_strict("#{name_nesting.take(index.succ).join(NAMESPACE_DELIMITER)}*") end end memoize :match_expressions diff --git a/lib/mutant/strategy.rb b/lib/mutant/strategy.rb index 48a2be58..bab21542 100644 --- a/lib/mutant/strategy.rb +++ b/lib/mutant/strategy.rb @@ -73,7 +73,7 @@ module Mutant def tests(subject) subject.match_expressions.each do |match_expression| tests = all_tests.select do |test| - test.expression.prefix?(match_expression) + match_expression.prefix?(test.expression) end return tests if tests.any? end diff --git a/spec/unit/mutant/subject_spec.rb b/spec/unit/mutant/subject_spec.rb index 16b74476..ef54bf87 100644 --- a/spec/unit/mutant/subject_spec.rb +++ b/spec/unit/mutant/subject_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' describe Mutant::Subject do let(:class_under_test) do Class.new(described_class) do - def match_expression - 'match' + def expression + Mutant::Expression.parse('Test') end end end @@ -34,6 +34,6 @@ describe Mutant::Subject do describe '#identification' do subject { object.identification } - it { should eql('match:source_path:source_line') } + it { should eql('Test:source_path:source_line') } end end