Do not present un idempotent interface on abstract class
This commit is contained in:
parent
cfd8ea8855
commit
82634f383c
5 changed files with 12 additions and 29 deletions
|
@ -61,7 +61,7 @@ module Mutant
|
|||
|
||||
begin
|
||||
data = Marshal.load(reader.read)
|
||||
rescue ArgumentError => exception
|
||||
rescue ArgumentError
|
||||
raise IsolationError, 'Childprocess wrote unmarshallable data'
|
||||
end
|
||||
|
||||
|
|
|
@ -57,8 +57,9 @@ module Mutant
|
|||
# @api private
|
||||
#
|
||||
def identification
|
||||
"#{subject.identification}:#{code}"
|
||||
"#{self.class::SYMBOL}:#{subject.identification}:#{code}"
|
||||
end
|
||||
memoize :identification
|
||||
|
||||
# Return mutation code
|
||||
#
|
||||
|
|
|
@ -6,17 +6,7 @@ module Mutant
|
|||
class Evil < self
|
||||
|
||||
SHOULD_FAIL = true
|
||||
|
||||
# Return identification
|
||||
#
|
||||
# @return [String]
|
||||
#
|
||||
# @api private
|
||||
#
|
||||
def identification
|
||||
"evil:#{super}"
|
||||
end
|
||||
memoize :identification
|
||||
SYMBOL = 'evil'.freeze
|
||||
|
||||
# Test if killer is successful
|
||||
#
|
||||
|
|
|
@ -15,17 +15,6 @@ module Mutant
|
|||
|
||||
end # Noop
|
||||
|
||||
# Return identification
|
||||
#
|
||||
# @return [String]
|
||||
#
|
||||
# @api private
|
||||
#
|
||||
def identification
|
||||
"#{self.class::SYMBOL}:#{super}"
|
||||
end
|
||||
memoize :identification
|
||||
|
||||
end # Neutral
|
||||
end # Mutation
|
||||
end # Mutant
|
||||
|
|
|
@ -4,10 +4,13 @@ require 'spec_helper'
|
|||
|
||||
describe Mutant::Mutation do
|
||||
|
||||
let(:class_under_test) { Class.new(described_class) { memoize :identification } }
|
||||
let(:object) { class_under_test.new(mutation_subject, Mutant::NodeHelpers::N_NIL) }
|
||||
let(:mutation_subject) { double('Subject', identification: 'subject', source: 'original') }
|
||||
let(:node) { double('Node') }
|
||||
class TestMutation < Mutant::Mutation
|
||||
SYMBOL = 'test'
|
||||
end
|
||||
|
||||
let(:object) { TestMutation.new(mutation_subject, Mutant::NodeHelpers::N_NIL) }
|
||||
let(:mutation_subject) { double('Subject', identification: 'subject', source: 'original') }
|
||||
let(:node) { double('Node') }
|
||||
|
||||
describe '#code' do
|
||||
subject { object.code }
|
||||
|
@ -37,7 +40,7 @@ describe Mutant::Mutation do
|
|||
|
||||
subject { object.identification }
|
||||
|
||||
it { should eql('subject:8771a') }
|
||||
it { should eql('test:subject:8771a') }
|
||||
|
||||
it_should_behave_like 'an idempotent method'
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue