2013-01-13 17:47:00 -05:00
|
|
|
module Mutant
|
|
|
|
class Strategy
|
|
|
|
class Rspec
|
|
|
|
class DM2
|
|
|
|
|
2013-04-17 23:31:21 -04:00
|
|
|
# Example lookup for the rspec dm2
|
2013-01-13 17:47:00 -05:00
|
|
|
class Lookup
|
2013-06-14 19:29:44 -04:00
|
|
|
include AbstractType, Adamantium::Flat, Concord::Public.new(:subject)
|
2013-01-13 17:47:00 -05:00
|
|
|
|
|
|
|
# Return glob expression
|
|
|
|
#
|
|
|
|
# @return [String]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
abstract_method :spec_files
|
|
|
|
|
|
|
|
# Perform example lookup
|
|
|
|
#
|
|
|
|
# @param [Subject] subject
|
|
|
|
#
|
|
|
|
# @return [Enumerable<String>]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def self.run(subject)
|
2013-01-21 17:54:25 -05:00
|
|
|
build(subject).spec_files
|
2013-01-13 17:47:00 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
REGISTRY = {}
|
|
|
|
|
|
|
|
# Register subject hander
|
|
|
|
#
|
|
|
|
# @param [Class:Subject]
|
|
|
|
#
|
|
|
|
# @return [undefined]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def self.handle(subject_class)
|
|
|
|
REGISTRY[subject_class]=self
|
|
|
|
end
|
|
|
|
private_class_method :handle
|
|
|
|
|
|
|
|
# Build lookup object
|
|
|
|
#
|
|
|
|
# @param [Subjecŧ] subject
|
|
|
|
#
|
2013-04-17 23:31:21 -04:00
|
|
|
# @return [Lookup]
|
2013-01-13 17:47:00 -05:00
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def self.build(subject)
|
|
|
|
REGISTRY.fetch(subject.class).new(subject)
|
|
|
|
end
|
|
|
|
|
2013-06-14 14:54:02 -04:00
|
|
|
end # Lookup
|
|
|
|
end # DM2
|
|
|
|
end # Rspec
|
|
|
|
end # Strategy
|
|
|
|
end # Mutant
|