free_mutant/lib/mutant/strategy.rb

52 lines
950 B
Ruby
Raw Normal View History

2012-11-21 18:10:50 -05:00
module Mutant
class Strategy
include AbstractClass
# Kill mutation
#
# @param [Mutation]
#
# @return [Killer]
#
# @api private
#
def self.kill(mutation)
killer.new(self, mutation)
end
def self.killer
self::KILLER
2012-11-21 18:10:50 -05:00
end
class Rspec < self
KILLER = Killer::Rspec
class DM2 < self
def self.filename_pattern(mutation)
name = mutation.subject.context.scope.name
append = mutation.subject.matcher.kind_of?(Matcher::Method::Singleton) ? '/class_methods' : ''
path = Inflector.underscore(name)
2012-11-21 20:51:30 -05:00
"spec/unit/#{path}#{append}/*_spec.rb"
2012-11-21 18:10:50 -05:00
end
end
class Unit < self
def self.filename_pattern(mutation)
2012-11-21 18:14:13 -05:00
'spec/unit/**/*_spec.rb'
end
end
class Full < self
def self.filename_pattern(mutation)
'spec/**/*_spec.rb'
2012-11-21 18:10:50 -05:00
end
end
end
end
end