free_mutant/lib/mutant/integration.rb
Markus Schirp 40c337ce5b Fine grained rspec integration
* Flattens the rspec example groups on filtering to remove redundant
  work being done on executing subtrees of already executed example
  groups
* Uses test batching to kill one mutation per isolation that results in
  a significant speedup.
* Drop rspec 2 support.

[closes #256]
2014-12-01 22:43:28 +00:00

83 lines
1.4 KiB
Ruby

module Mutant
# Abstract base class mutant test framework integrations
class Integration
include AbstractType, Adamantium::Flat, Equalizer.new
REGISTRY = {}
# Lookup integration for name
#
# @param [String] name
#
# @return [Integration]
# if found
#
# @api private
#
def self.lookup(name)
REGISTRY.fetch(name).new
end
# Register integration
#
# @param [String] name
#
# @return [undefined]
#
# @api private
#
def self.register(name)
REGISTRY[name] = self
define_method(:name) { name }
end
private_class_method :register
# Perform integration setup
#
# @return [self]
#
# @api private
#
def setup
self
end
# Return test result for tests
#
# @param [Enumerable<Test>] tests
#
# @return [Result::Test]
#
# @api private
#
abstract_method :call
# Return all available tests by integration
#
# @return [Enumerable<Test>]
#
# @api private
#
abstract_method :all_tests
# Null integration that never kills a mutation
class Null < self
register('null')
# Return all tests
#
# @return [Enumerable<Test>]
#
# @api private
#
def all_tests
EMPTY_ARRAY
end
end # Null
end # Integration
end # Mutant