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 [undefined]
def mutations
mutations = [neutral_mutation]
Mutator.each(node) do |mutant|
mutations << Mutation::Evil.new(self, wrap_node(mutant))
end
mutations
[neutral_mutation].concat(
Mutator.each(node).map do |mutant|
Mutation::Evil.new(self, wrap_node(mutant))
end
)
end
memoize :mutations

View file

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

View file

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

View file

@ -71,7 +71,7 @@ RSpec.describe Mutant::Subject do
subject { object.mutations }
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
let(:mutation_a) { double('Mutation A') }