Fix coverage for Mutant::Subject* namespace

This commit is contained in:
Markus Schirp 2016-02-14 04:28:59 +00:00
parent 690fcfdab0
commit e185f2a938
4 changed files with 8 additions and 9 deletions

View file

@ -9,11 +9,11 @@ module Mutant
# @return [Enumerable<Mutation>] # @return [Enumerable<Mutation>]
# @return [undefined] # @return [undefined]
def mutations def mutations
mutations = [neutral_mutation] [neutral_mutation].concat(
Mutator.each(node) do |mutant| Mutator.each(node).map do |mutant|
mutations << Mutation::Evil.new(self, wrap_node(mutant)) Mutation::Evil.new(self, wrap_node(mutant))
end end
mutations )
end end
memoize :mutations memoize :mutations

View file

@ -24,8 +24,7 @@ module Mutant
# @return [self] # @return [self]
def prepare def prepare
scope.__send__(:memoized_methods).instance_variable_get(:@memory).delete(name) scope.__send__(:memoized_methods).instance_variable_get(:@memory).delete(name)
super super()
self
end end
private private

View file

@ -103,7 +103,7 @@ RSpec.describe Mutant::Subject::Method::Instance::Memoized do
it_should_behave_like 'a command method' it_should_behave_like 'a command method'
end end
describe '#mutations' do describe '#mutations', mutant_expression: 'Mutant::Subject#mutations' do
subject { object.mutations } subject { object.mutations }
let(:expected) do let(:expected) do

View file

@ -71,7 +71,7 @@ RSpec.describe Mutant::Subject do
subject { object.mutations } subject { object.mutations }
before do before do
expect(Mutant::Mutator).to receive(:each).with(node).and_yield(mutation_a).and_yield(mutation_b) expect(Mutant::Mutator).to receive(:each).with(node).and_return([mutation_a, mutation_b])
end end
let(:mutation_a) { double('Mutation A') } let(:mutation_a) { double('Mutation A') }