Reduce public interface of Subject
This commit is contained in:
parent
87f4d0bd15
commit
84b259ab6a
3 changed files with 5 additions and 16 deletions
|
@ -99,7 +99,7 @@ module Mutant
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
def root
|
def root
|
||||||
subject.root(node)
|
subject.context.root(node)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Evil mutation that should case mutations to fail tests
|
# Evil mutation that should case mutations to fail tests
|
||||||
|
|
|
@ -88,18 +88,6 @@ module Mutant
|
||||||
end
|
end
|
||||||
memoize :source
|
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 match expression
|
||||||
#
|
#
|
||||||
# @return [Expression]
|
# @return [Expression]
|
||||||
|
|
|
@ -5,7 +5,8 @@ RSpec.describe Mutant::Mutation do
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:object) { TestMutation.new(mutation_subject, Mutant::AST::Nodes::N_NIL) }
|
let(:object) { TestMutation.new(mutation_subject, Mutant::AST::Nodes::N_NIL) }
|
||||||
let(:mutation_subject) { double('Subject', identification: 'subject', source: 'original') }
|
let(:mutation_subject) { double('Subject', identification: 'subject', context: context, source: 'original') }
|
||||||
|
let(:context) { double('Context') }
|
||||||
|
|
||||||
describe '#code' do
|
describe '#code' do
|
||||||
subject { object.code }
|
subject { object.code }
|
||||||
|
@ -31,7 +32,7 @@ RSpec.describe Mutant::Mutation do
|
||||||
before do
|
before do
|
||||||
expect(mutation_subject).to receive(:public?).ordered.and_return(true)
|
expect(mutation_subject).to receive(:public?).ordered.and_return(true)
|
||||||
expect(mutation_subject).to receive(:prepare).ordered
|
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)
|
expect(Mutant::Loader::Eval).to receive(:call).ordered.with(wrapped_node, mutation_subject).and_return(nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue