Fix duplicate emit of neutral mutaiton on memoized instance methods
This commit is contained in:
parent
14e95080ed
commit
23bf4d2bd6
2 changed files with 14 additions and 1 deletions
|
@ -85,7 +85,6 @@ module Mutant
|
|||
# @api private
|
||||
#
|
||||
def generate_mutations(emitter)
|
||||
emitter << neutral_mutation
|
||||
Mutator.each(node) do |mutant|
|
||||
emitter << Mutation::Evil.new(self, memoizer_node(mutant))
|
||||
end
|
||||
|
|
|
@ -124,6 +124,20 @@ RSpec.describe Mutant::Subject::Method::Instance::Memoized do
|
|||
it_should_behave_like 'a command method'
|
||||
end
|
||||
|
||||
describe '#mutations' do
|
||||
subject { object.mutations }
|
||||
|
||||
let(:expected) do
|
||||
[
|
||||
Mutant::Mutation::Neutral.new(object, s(:begin, s(:def, :foo, s(:args)), s(:send, nil, :memoize, s(:args, s(:sym, :foo))))),
|
||||
Mutant::Mutation::Evil.new(object, s(:begin, s(:def, :foo, s(:args), s(:send, nil, :raise)), s(:send, nil, :memoize, s(:args, s(:sym, :foo))))),
|
||||
Mutant::Mutation::Evil.new(object, s(:begin, s(:def, :foo, s(:args), nil), s(:send, nil, :memoize, s(:args, s(:sym, :foo))))),
|
||||
]
|
||||
end
|
||||
|
||||
it { should eql(expected) }
|
||||
end
|
||||
|
||||
describe '#source' do
|
||||
subject { object.source }
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue