Fix object cycle
Strategy currently does not need to be initialized with config.
This commit is contained in:
parent
d1aed52877
commit
7ae6e09908
6 changed files with 25 additions and 26 deletions
|
@ -102,7 +102,6 @@ module Mutant
|
||||||
#
|
#
|
||||||
def strategy
|
def strategy
|
||||||
@strategy or raise(Error, 'No strategy was set!')
|
@strategy or raise(Error, 'No strategy was set!')
|
||||||
@strategy.new(self)
|
|
||||||
end
|
end
|
||||||
memoize :strategy
|
memoize :strategy
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ module Mutant
|
||||||
|
|
||||||
# Abstract base class for killing strategies
|
# Abstract base class for killing strategies
|
||||||
class Strategy
|
class Strategy
|
||||||
include AbstractType, Adamantium::Flat, Concord::Public.new(:config)
|
include AbstractType, Adamantium::Flat
|
||||||
|
|
||||||
# Perform setup
|
# Perform setup
|
||||||
#
|
#
|
||||||
|
@ -10,7 +10,7 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
def setup
|
def self.setup
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
def teardown
|
def self.teardown
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
def kill(mutation)
|
def self.kill(mutation)
|
||||||
killer.new(self, mutation)
|
killer.new(self, mutation)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -42,8 +42,8 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
def killer
|
def self.killer
|
||||||
self.class::KILLER
|
self::KILLER
|
||||||
end
|
end
|
||||||
|
|
||||||
end # Strategy
|
end # Strategy
|
||||||
|
|
|
@ -12,7 +12,7 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
def setup
|
def self.setup
|
||||||
require('./spec/spec_helper.rb')
|
require('./spec/spec_helper.rb')
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
@ -26,7 +26,7 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
def spec_files(mutation)
|
def self.spec_files(mutation)
|
||||||
Dir['spec/unit/**/*_spec.rb']
|
Dir['spec/unit/**/*_spec.rb']
|
||||||
end
|
end
|
||||||
end # Unit
|
end # Unit
|
||||||
|
@ -40,7 +40,7 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
def spec_files(mutation)
|
def self.spec_files(mutation)
|
||||||
Dir['spec/integration/**/*_spec.rb']
|
Dir['spec/integration/**/*_spec.rb']
|
||||||
end
|
end
|
||||||
end # Integration
|
end # Integration
|
||||||
|
@ -54,7 +54,7 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
def spec_files(mutation)
|
def self.spec_files(mutation)
|
||||||
Dir['spec/**/*_spec.rb']
|
Dir['spec/**/*_spec.rb']
|
||||||
end
|
end
|
||||||
end # Full
|
end # Full
|
||||||
|
|
|
@ -12,7 +12,7 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
def spec_files(subject)
|
def self.spec_files(subject)
|
||||||
Lookup.run(subject)
|
Lookup.run(subject)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,16 @@ module Mutant
|
||||||
#
|
#
|
||||||
abstract_method :public?
|
abstract_method :public?
|
||||||
|
|
||||||
|
# Return method name
|
||||||
|
#
|
||||||
|
# @return [Symbol]
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
|
#
|
||||||
|
def name
|
||||||
|
node.children[self.class::NAME_INDEX]
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# Return scope
|
# Return scope
|
||||||
|
@ -27,16 +37,6 @@ module Mutant
|
||||||
context.scope
|
context.scope
|
||||||
end
|
end
|
||||||
|
|
||||||
# Return method name
|
|
||||||
#
|
|
||||||
# @return [Symbol]
|
|
||||||
#
|
|
||||||
# @api private
|
|
||||||
#
|
|
||||||
def name
|
|
||||||
node.children[self.class::NAME_INDEX]
|
|
||||||
end
|
|
||||||
|
|
||||||
# Return subtype identifier
|
# Return subtype identifier
|
||||||
#
|
#
|
||||||
# @return [String]
|
# @return [String]
|
||||||
|
|
|
@ -8,10 +8,10 @@ end
|
||||||
|
|
||||||
shared_examples_for 'a cli parser' do
|
shared_examples_for 'a cli parser' do
|
||||||
subject { cli.config }
|
subject { cli.config }
|
||||||
its(:filter) { should eql(expected_filter) }
|
its(:filter) { should eql(expected_filter) }
|
||||||
its(:strategy) { should eql(expected_strategy.new(subject)) }
|
its(:strategy) { should eql(expected_strategy) }
|
||||||
its(:reporter) { should eql(expected_reporter) }
|
its(:reporter) { should eql(expected_reporter) }
|
||||||
its(:matcher) { should eql(expected_matcher) }
|
its(:matcher) { should eql(expected_matcher) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe Mutant::CLI, '.new' do
|
describe Mutant::CLI, '.new' do
|
||||||
|
|
Loading…
Reference in a new issue