Fix object cycle

Strategy currently does not need to be initialized with config.
This commit is contained in:
Markus Schirp 2013-06-15 16:32:40 +02:00
parent d1aed52877
commit 7ae6e09908
6 changed files with 25 additions and 26 deletions

View file

@ -102,7 +102,6 @@ module Mutant
#
def strategy
@strategy or raise(Error, 'No strategy was set!')
@strategy.new(self)
end
memoize :strategy

View file

@ -2,7 +2,7 @@ module Mutant
# Abstract base class for killing strategies
class Strategy
include AbstractType, Adamantium::Flat, Concord::Public.new(:config)
include AbstractType, Adamantium::Flat
# Perform setup
#
@ -10,7 +10,7 @@ module Mutant
#
# @api private
#
def setup
def self.setup
self
end
@ -20,7 +20,7 @@ module Mutant
#
# @api private
#
def teardown
def self.teardown
self
end
@ -32,7 +32,7 @@ module Mutant
#
# @api private
#
def kill(mutation)
def self.kill(mutation)
killer.new(self, mutation)
end
@ -42,8 +42,8 @@ module Mutant
#
# @api private
#
def killer
self.class::KILLER
def self.killer
self::KILLER
end
end # Strategy

View file

@ -12,7 +12,7 @@ module Mutant
#
# @api private
#
def setup
def self.setup
require('./spec/spec_helper.rb')
self
end
@ -26,7 +26,7 @@ module Mutant
#
# @api private
#
def spec_files(mutation)
def self.spec_files(mutation)
Dir['spec/unit/**/*_spec.rb']
end
end # Unit
@ -40,7 +40,7 @@ module Mutant
#
# @api private
#
def spec_files(mutation)
def self.spec_files(mutation)
Dir['spec/integration/**/*_spec.rb']
end
end # Integration
@ -54,7 +54,7 @@ module Mutant
#
# @api private
#
def spec_files(mutation)
def self.spec_files(mutation)
Dir['spec/**/*_spec.rb']
end
end # Full

View file

@ -12,7 +12,7 @@ module Mutant
#
# @api private
#
def spec_files(subject)
def self.spec_files(subject)
Lookup.run(subject)
end

View file

@ -15,6 +15,16 @@ module Mutant
#
abstract_method :public?
# Return method name
#
# @return [Symbol]
#
# @api private
#
def name
node.children[self.class::NAME_INDEX]
end
private
# Return scope
@ -27,16 +37,6 @@ module Mutant
context.scope
end
# Return method name
#
# @return [Symbol]
#
# @api private
#
def name
node.children[self.class::NAME_INDEX]
end
# Return subtype identifier
#
# @return [String]

View file

@ -8,10 +8,10 @@ end
shared_examples_for 'a cli parser' do
subject { cli.config }
its(:filter) { should eql(expected_filter) }
its(:strategy) { should eql(expected_strategy.new(subject)) }
its(:reporter) { should eql(expected_reporter) }
its(:matcher) { should eql(expected_matcher) }
its(:filter) { should eql(expected_filter) }
its(:strategy) { should eql(expected_strategy) }
its(:reporter) { should eql(expected_reporter) }
its(:matcher) { should eql(expected_matcher) }
end
describe Mutant::CLI, '.new' do