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
|
begin
|
||||||
data = Marshal.load(reader.read)
|
data = Marshal.load(reader.read)
|
||||||
rescue ArgumentError => exception
|
rescue ArgumentError
|
||||||
raise IsolationError, 'Childprocess wrote unmarshallable data'
|
raise IsolationError, 'Childprocess wrote unmarshallable data'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -57,8 +57,9 @@ module Mutant
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
def identification
|
def identification
|
||||||
"#{subject.identification}:#{code}"
|
"#{self.class::SYMBOL}:#{subject.identification}:#{code}"
|
||||||
end
|
end
|
||||||
|
memoize :identification
|
||||||
|
|
||||||
# Return mutation code
|
# Return mutation code
|
||||||
#
|
#
|
||||||
|
|
|
@ -6,17 +6,7 @@ module Mutant
|
||||||
class Evil < self
|
class Evil < self
|
||||||
|
|
||||||
SHOULD_FAIL = true
|
SHOULD_FAIL = true
|
||||||
|
SYMBOL = 'evil'.freeze
|
||||||
# Return identification
|
|
||||||
#
|
|
||||||
# @return [String]
|
|
||||||
#
|
|
||||||
# @api private
|
|
||||||
#
|
|
||||||
def identification
|
|
||||||
"evil:#{super}"
|
|
||||||
end
|
|
||||||
memoize :identification
|
|
||||||
|
|
||||||
# Test if killer is successful
|
# Test if killer is successful
|
||||||
#
|
#
|
||||||
|
|
|
@ -15,17 +15,6 @@ module Mutant
|
||||||
|
|
||||||
end # Noop
|
end # Noop
|
||||||
|
|
||||||
# Return identification
|
|
||||||
#
|
|
||||||
# @return [String]
|
|
||||||
#
|
|
||||||
# @api private
|
|
||||||
#
|
|
||||||
def identification
|
|
||||||
"#{self.class::SYMBOL}:#{super}"
|
|
||||||
end
|
|
||||||
memoize :identification
|
|
||||||
|
|
||||||
end # Neutral
|
end # Neutral
|
||||||
end # Mutation
|
end # Mutation
|
||||||
end # Mutant
|
end # Mutant
|
||||||
|
|
|
@ -4,10 +4,13 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe Mutant::Mutation do
|
describe Mutant::Mutation do
|
||||||
|
|
||||||
let(:class_under_test) { Class.new(described_class) { memoize :identification } }
|
class TestMutation < Mutant::Mutation
|
||||||
let(:object) { class_under_test.new(mutation_subject, Mutant::NodeHelpers::N_NIL) }
|
SYMBOL = 'test'
|
||||||
let(:mutation_subject) { double('Subject', identification: 'subject', source: 'original') }
|
end
|
||||||
let(:node) { double('Node') }
|
|
||||||
|
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
|
describe '#code' do
|
||||||
subject { object.code }
|
subject { object.code }
|
||||||
|
@ -37,7 +40,7 @@ describe Mutant::Mutation do
|
||||||
|
|
||||||
subject { object.identification }
|
subject { object.identification }
|
||||||
|
|
||||||
it { should eql('subject:8771a') }
|
it { should eql('test:subject:8771a') }
|
||||||
|
|
||||||
it_should_behave_like 'an idempotent method'
|
it_should_behave_like 'an idempotent method'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue