Sha256: 504d83eb29b7c027295a7e110fadb6d000767f4266c902435b4fa208bb97f8cb

Contents?: true

Size: 1.2 KB

Versions: 7

Compression:

Stored size: 1.2 KB

Contents

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).build
    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 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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mutant-0.6.7 lib/mutant/integration.rb
mutant-0.6.6 lib/mutant/integration.rb
mutant-0.6.5 lib/mutant/integration.rb
mutant-0.6.4 lib/mutant/integration.rb
mutant-0.6.3 lib/mutant/integration.rb
mutant-0.6.2 lib/mutant/integration.rb
mutant-0.6.0 lib/mutant/integration.rb