diff --git a/lib/mutant/mutation.rb b/lib/mutant/mutation.rb index 545c2e8b..0d632cc0 100644 --- a/lib/mutant/mutation.rb +++ b/lib/mutant/mutation.rb @@ -99,7 +99,7 @@ module Mutant # @api private # def root - subject.root(node) + subject.context.root(node) end # Evil mutation that should case mutations to fail tests diff --git a/lib/mutant/subject.rb b/lib/mutant/subject.rb index 5cc6be83..5b8561c8 100644 --- a/lib/mutant/subject.rb +++ b/lib/mutant/subject.rb @@ -88,18 +88,6 @@ module Mutant end memoize :source - # Return root AST for node - # - # @param [Parser::AST::Node] node - # - # @return [Parser::AST::Node] - # - # @api private - # - def root(node) - context.root(node) - end - # Return match expression # # @return [Expression] diff --git a/spec/unit/mutant/mutation_spec.rb b/spec/unit/mutant/mutation_spec.rb index 51318329..0ffe057d 100644 --- a/spec/unit/mutant/mutation_spec.rb +++ b/spec/unit/mutant/mutation_spec.rb @@ -4,8 +4,9 @@ RSpec.describe Mutant::Mutation do SYMBOL = 'test'.freeze end - let(:object) { TestMutation.new(mutation_subject, Mutant::AST::Nodes::N_NIL) } - let(:mutation_subject) { double('Subject', identification: 'subject', source: 'original') } + let(:object) { TestMutation.new(mutation_subject, Mutant::AST::Nodes::N_NIL) } + let(:mutation_subject) { double('Subject', identification: 'subject', context: context, source: 'original') } + let(:context) { double('Context') } describe '#code' do subject { object.code } @@ -31,7 +32,7 @@ RSpec.describe Mutant::Mutation do before do expect(mutation_subject).to receive(:public?).ordered.and_return(true) expect(mutation_subject).to receive(:prepare).ordered - expect(mutation_subject).to receive(:root).ordered.with(s(:nil)).and_return(wrapped_node) + expect(context).to receive(:root).ordered.with(s(:nil)).and_return(wrapped_node) expect(Mutant::Loader::Eval).to receive(:call).ordered.with(wrapped_node, mutation_subject).and_return(nil) end